MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / sendTelemetryEventInternal

Function sendTelemetryEventInternal

src/platform/telemetry/index.ts:165–201  ·  view source on GitHub ↗
(
    eventName: E,
    measures?: Record<string, number>,
    properties?: P[E],
    ex?: Error
)

Source from the content-addressed store, hash-verified

163> = P[E] extends TelemetryEventInfo<infer R> ? PickType<UnionToIntersection<R>, number> : undefined;
164
165function sendTelemetryEventInternal<P extends IEventNamePropertyMapping, E extends keyof P>(
166 eventName: E,
167 measures?: Record<string, number>,
168 properties?: P[E],
169 ex?: Error
170) {
171 const reporter = getTelemetryReporter();
172 let customProperties: Record<string, string> = {};
173 let eventNameSent = eventName as string;
174
175 if (ex) {
176 // Include a property failed, to indicate there are errors.
177 // Lets pay the price for better data.
178 customProperties = {};
179 // Add shared properties to telemetry props (we may overwrite existing ones).
180 Object.assign(customProperties, sharedProperties);
181 Object.assign(customProperties, properties || {});
182 populateTelemetryWithErrorInfo(customProperties, ex)
183 .then(() => {
184 customProperties = sanitizeProperties(eventNameSent, customProperties);
185 reporter.sendTelemetryEvent(eventNameSent, customProperties, measures);
186 })
187 .catch(noop);
188 } else {
189 if (properties) {
190 customProperties = sanitizeProperties(eventNameSent, properties);
191 }
192
193 // Add shared properties to telemetry props (we may overwrite existing ones).
194 Object.assign(customProperties, sharedProperties);
195 if (isPerfMeasurementOnCI(eventNameSent)) {
196 reporter.sendDangerousTelemetryEvent(eventNameSent, customProperties, measures);
197 } else {
198 reporter.sendTelemetryEvent(eventNameSent, customProperties, measures);
199 }
200 }
201}
202
203// Type-parameterized form of MethodDecorator in lib.es5.d.ts.
204type TypedMethodDescriptor<T> = (

Callers 1

sendTelemetryEventFunction · 0.85

Calls 6

getTelemetryReporterFunction · 0.85
sanitizePropertiesFunction · 0.85
isPerfMeasurementOnCIFunction · 0.85
assignMethod · 0.80
sendTelemetryEventMethod · 0.45

Tested by

no test coverage detected