Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import { LogExperimentExposureReq } from "proto/bugs_pb";
import client from "./client";
export type ExposureReport = {
experimentKey: string;
experimentName: string;
variationId: number;
variationKey: string;
variationName: string;
hashAttribute: string;
hashValue: string;
featureId: string;
inExperiment: boolean;
bucket?: number;
hashUsed?: boolean;
stickyBucketUsed?: boolean;
};
export async function reportExposure(exposure: ExposureReport): Promise<void> {
const req = new LogExperimentExposureReq();
req.setExperimentKey(exposure.experimentKey);
req.setExperimentName(exposure.experimentName);
req.setVariationId(exposure.variationId);
req.setVariationKey(exposure.variationKey);
req.setVariationName(exposure.variationName);
req.setHashAttribute(exposure.hashAttribute);
req.setHashValue(exposure.hashValue);
req.setFeatureId(exposure.featureId);
req.setInExperiment(exposure.inExperiment);
Iif (exposure.bucket !== undefined) {
req.setBucket(exposure.bucket);
}
Iif (exposure.hashUsed !== undefined) {
req.setHashUsed(exposure.hashUsed);
}
Iif (exposure.stickyBucketUsed !== undefined) {
req.setStickyBucketUsed(exposure.stickyBucketUsed);
}
await client.bugs.logExperimentExposure(req);
}
|