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' });
Fields
sendEventData(eventName:String, ?data:Record<String, Any>):Void
Function to send event data without a stacktrace. Used within a {@link TelemetryLogger}
Parameters:
eventName | The name of the event which you are logging |
---|---|
data | A serializable key value pair that is being logged |
sendErrorData(error:Error, ?data:Record<String, Any>):Void
Function to send an error. Used within a {@link TelemetryLogger}
Parameters:
error | The error being logged |
---|---|
data | Any additional data to be collected with the exception |
flush():Thenable<Void>
Optional flush function which will give this sender a chance to send any remaining events as its {@link TelemetryLogger} is being disposed