import type { TelemetrySender } from 'vscode'; import { IDisposable } from '../../../util/vs/base/common/lifecycle'; import { ICopilotTokenStore } from '../../authentication/common/copilotTokenStore'; import type { TelemetryData } from './telemetryData'; export interface TelemetryEventMeasurements { readonly [key: string]: number | undefined; } export interface TelemetryEventProperties { readonly [key: string]: string | import('vscode').TelemetryTrustedValue | undefined; } /** * Telemetry for the experimentation service. */ export interface IExperimentationTelemetry { /** * Set shared property for all events. * @param name The name of the shared property. * @param value The value of the shared property. */ setSharedProperty(name: string, value: string): void; /** * Posts an event into the telemetry implementation. */ postEvent(eventName: string, props: Map): void; } export declare const ITelemetryUserConfig: import("../../../util/common/services").ServiceIdentifier; export interface ITelemetryUserConfig { readonly _serviceBrand: undefined; trackingId: string | undefined; organizationsList: string | undefined; enterpriseList: string | undefined; optedIn: boolean; } export declare class TelemetryUserConfigImpl implements ITelemetryUserConfig { private readonly _tokenStore; readonly _serviceBrand: undefined; trackingId: string | undefined; organizationsList: string | undefined; enterpriseList: string | undefined; optedIn: boolean; constructor(trackingId: string | undefined, optedIn: boolean | undefined, _tokenStore: ICopilotTokenStore); private updateFromToken; } export type TelemetryProperties = { [key: string]: string; }; export type AdditionalTelemetryProperties = { [key: string]: string; }; /** * Creates a getter that returns the tracking ID from the token store. * The cache is: * - initialized from the current token (if available) when the getter is created * - updated whenever the token store changes * - returned even when the token is temporarily unavailable */ export declare function createTrackingIdGetter(tokenStore: ICopilotTokenStore): () => string | undefined; export type TelemetryDestination = { github: boolean | { eventNamePrefix: string; }; microsoft: boolean; }; export interface ITelemetryService extends IExperimentationTelemetry, IDisposable { readonly _serviceBrand: undefined; /** * Send a Microsoft internal telemetry event. * * @remark This is a no-op if the user is not part of an allowed organization. * @remark This event does not require GDPR comments due to being classified in a special manner for internal use only. */ sendInternalMSFTTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendMSFTTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendMSFTTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendGHTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendGHTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendGHTelemetryException(maybeError: unknown, origin: string): void; sendEnhancedGHTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendEnhancedGHTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendTelemetryEvent(eventName: string, destination: TelemetryDestination, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendTelemetryEvent(eventName: TTelemetryEvent['eventName'], destination: TelemetryDestination, properties?: TTelemetryEvent['properties'], measurements?: TTelemetryEvent['measurements']): void; sendTelemetryErrorEvent(eventName: string, destination: TelemetryDestination, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; setAdditionalExpAssignments(expAssignments: string[]): void; } export interface ITelemetryEvent { eventName: string; properties?: object; measurements?: object; } /** * The "sub services" which power the telemetry service and send telemetry to the appropriate endpoints. */ export interface ITelemetrySender extends IDisposable { sendTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; sendTelemetryErrorEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; } export declare const ITelemetryService: import("../../../util/common/services").ServiceIdentifier; export interface IMSFTTelemetrySender extends ITelemetrySender { /** * Send a Microsoft internal telemetry event. * * @remark This is a no-op if the user is not part of an allowed organization. * @remark This event does not require GDPR comments due to be classified in a special manner for internal use only. */ sendInternalTelemetryEvent(eventName: string, properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void; } export interface IGHTelemetryService { readonly _serviceBrand: undefined; setSecureReporter(reporter: TelemetrySender | undefined): void; setReporter(reporter: TelemetrySender | undefined): void; /** * Standard telemetry events can be disabled with VS Code's telemetry settings. */ sendTelemetry(name: string, telemetryData?: TelemetryData): Promise; /** * Standard telemetry events can be disabled with VS Code's telemetry settings. */ sendErrorTelemetry(name: string, telemetryData?: TelemetryData): Promise; /** * Enhanced telemetry events contain additional data such as user prompts and suggestions. Like standard telemetry events, it can disabled with VS Code's telemetry settings or the Copilot settings page. * * You can manage this setting on the Copilot settings page https://github.com/settings/copilot/features * Learn about configuring this telemetry at https://docs.github.com/en/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/managing-your-copilot-plan/managing-copilot-policies-as-an-individual-subscriber#enabling-or-disabling-prompt-and-suggestion-collection * Learn more about the data collected at https://github.com/features/copilot/#faq */ sendEnhancedTelemetry(name: string, telemetryData?: TelemetryData): Promise; /** * Enhanced telemetry events contain additional data such as user prompts and suggestions. Like standard telemetry events, it can disabled with VS Code's telemetry settings or the Copilot settings page. * * You can manage this setting on the Copilot settings page https://github.com/settings/copilot/features * Learn about configuring this telemetry at https://docs.github.com/en/copilot/managing-copilot/managing-copilot-as-an-individual-subscriber/managing-your-copilot-plan/managing-copilot-policies-as-an-individual-subscriber#enabling-or-disabling-prompt-and-suggestion-collection * Learn more about the data collected at https://github.com/features/copilot/#faq */ sendEnhancedErrorTelemetry(name: string, telemetryData?: TelemetryData): Promise; sendExpProblemTelemetry(telemetryProperties: { reason: string; }): Promise; sendExceptionTelemetry(maybeError: unknown, origin: string): Promise; deactivate(): Promise; } /** * Borrowed from https://github.com/microsoft/vscode/blob/9e560ad042bbc97e98f241f58cd08ddde0458a30/src/vs/platform/telemetry/common/telemetryUtils.ts#L21-L25 * Used as an API type in the vscode.d.ts as well to indicate properties that are exempt from cleaning. */ export declare class TelemetryTrustedValue { readonly value: T; readonly isTrustedTelemetryValue = true; constructor(value: T); } /** * Registers the process-wide compressor used by {@link multiplexProperties}. Called once from the * Node layer with a function that resolves to the base64-encoded gzip of its input. */ export declare function setTelemetryPropertyCompressor(compress: (value: string) => Promise): void; /** * Ensures every string property survives the Application Insights per-property truncation at * {@link MAX_PROPERTY_LENGTH}. Values that already fit pass through untouched. * * When a value is too long it is chunked. If a compressor is available (the normal case, registered * via {@link setTelemetryPropertyCompressor}), the value is chunked in compressed form only: the * full value is gzip + base64 compressed and emitted as `Chunk`, `Chunk_2`, * `Chunk_3`, ... (first column has no numeric suffix, the rest are NOT zero-padded, each * capped at {@link MAX_PROPERTY_LENGTH}), and the original `` column simply carries the first * uncompressed chunk of the value. No redundant plain continuation family (`_02`, ...) is * produced in this case. * * Fields in {@link ALWAYS_COMPRESSED_CHUNK_KEYS} always get the compressed chunk family (when a * compressor is available) even if they fit within {@link MAX_PROPERTY_LENGTH}, so the backend can * always read them from the `Chunk` family without branching on size. * * If no compressor is available, the value falls back to the plain continuation family (``, * `_02`, `_03`, ...). `compress` can be passed explicitly to override the registered * compressor (used by tests). */ export declare function multiplexProperties(properties: { [key: string]: string | undefined; }, compress?: ((value: string) => Promise) | undefined): Promise<{ [key: string]: string | undefined; }>; //# sourceMappingURL=telemetry.d.ts.map