Skip to content

Commit 4209277

Browse files
author
Kartik Raj
authored
Use random sampling for sending Python environments API telemetry (#23103)
1 parent b9109cf commit 4209277

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/client/environmentApi.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,14 @@ export function buildEnvironmentApi(
134134
extensions
135135
.determineExtensionFromCallStack()
136136
.then((info) => {
137-
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
138-
apiName,
139-
extensionId: info.extensionId,
140-
});
137+
const p = Math.random();
138+
if (p <= 0.001) {
139+
// Only send API telemetry 1% of the time, as it can be chatty.
140+
sendTelemetryEvent(EventName.PYTHON_ENVIRONMENTS_API, undefined, {
141+
apiName,
142+
extensionId: info.extensionId,
143+
});
144+
}
141145
traceVerbose(`Extension ${info.extensionId} accessed ${apiName} with args: ${JSON.stringify(args)}`);
142146
})
143147
.ignoreErrors();

0 commit comments

Comments
 (0)