Interface TelemetrySender

The telemetry sender is the contract between a telemetry logger and some telemetry service. Note that extensions must NOT call the methods of their sender directly as the logger provides extra guards and cleaning.

const sender: vscode.TelemetrySender = {...};
const logger = vscode.env.createTelemetryLogger(sender);

// GOOD - uses the logger
logger.logUsage('myEvent', { myData: 'myValue' });

// BAD - uses the sender directly: no data cleansing, ignores user settings, no echoing to the telemetry output channel etc
sender.logEvent('myEvent', { myData: 'myValue' });
interface TelemetrySender {
    flush?(): void | Thenable<void>;
    sendErrorData(error, data?): void;
    sendEventData(eventName, data?): void;
}

Methods

  • Function to send an error. Used within a TelemetryLogger

    Parameters

    • error: Error

      The error being logged

    • Optional data: Record<string, any>

      Any additional data to be collected with the exception

    Returns void

  • Function to send event data without a stacktrace. Used within a TelemetryLogger

    Parameters

    • eventName: string

      The name of the event which you are logging

    • Optional data: Record<string, any>

      A serializable key value pair that is being logged

    Returns void