Skip to content

Commit

Permalink
added manual exposures for java
Browse files Browse the repository at this point in the history
  • Loading branch information
brock-statsig committed Dec 17, 2024
1 parent 1bb2fc3 commit ca2d5be
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docs/server/java/_manualExposures.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import CodeBlock from "@theme/CodeBlock";

import ManualExposuresTemplate from "../../sdks/_manual-exposures-template.mdx";

export const Snippets = {
// Gates
gateSnippet: (
<CodeBlock language="java">
{`val passed_or_failed = Statsig.checkGateWithExposureLoggingDisabled(user, "a_gate");`}
</CodeBlock>
),
gateExposureSnippet: (
<CodeBlock language="java">
{`Statsig.manuallyLogGateExposure(user, "a_gate");`}
</CodeBlock>
),
// Configs
configSnippet: (
<CodeBlock language="java">
{`val config = Statsig.getConfigWithExposureLoggingDisabled(user, "awesome_product_details")`}
</CodeBlock>
),
configExposureSnippet: (
<CodeBlock language="java">
{`Statsig.manuallyLogConfigExposure(user, "awesome_product_details");`}
</CodeBlock>
),
// Experiment
experimentSnippet: (
<CodeBlock language="java">
{`val titleExperiment = Statsig.getExperimentWithExposureLoggingDisabled(user, "new_user_promo_title")`}
</CodeBlock>
),
experimentExposureSnippet: (
<CodeBlock language="java">
{`Statsig.manuallyLogConfigExposure(user, "new_user_promo_title");`}
</CodeBlock>
),
// Layer
layerSnippet: (
<CodeBlock language="java">
{`val layer = Statsig.getLayerWithExposureLoggingDisabled(user, "user_promo_experiments")
val promoTitle = layer.getString("title", "Welcome to Statsig!")`}
</CodeBlock>
),
layerExposureSnippet: (
<CodeBlock language="java">
{`Statsig.manuallyLogLayerParameterExposure(user, "user_promo_experiments");`}
</CodeBlock>
),
};

;
2 changes: 2 additions & 0 deletions docs/server/javaSdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import ShutdownSnippet from "./java/_shutdown.mdx";
import OverridesSnippet from "./java/_localOverrides.mdx";
import * as ReferenceSnippets from "./java/_reference.mdx";
import ClientInitResponseSnippet from "./java/_clientInitResponse.mdx";
import { Snippets as ManualExposureSnippets } from "./java/_manualExposures.mdx";
import ForwardProxyExample from "./java/_forwardProxyExample.mdx";
import MultiInstanceExample from "./java/_multiInstanceExample.mdx";
import PersistentStorageInterface from "./java/_persistentStorageInterface.mdx";
Expand Down Expand Up @@ -91,6 +92,7 @@ export const Builder = SDKDocsBuilder({
snippet: <OverridesSnippet />,
},
],
[ManualExposures, { addedInVersion: "0.11.0", ...ManualExposureSnippets }],
[
UserPersistentStorage,
{ interface: <PersistentStorageInterface />, example: <PersistentStorageExample /> },
Expand Down

0 comments on commit ca2d5be

Please sign in to comment.