Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-extension-telemetry

Package Overview
Dependencies
Maintainers
6
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-extension-telemetry - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

4

lib/telemetryReporter.d.ts

@@ -12,3 +12,3 @@ export default class TelemetryReporter {

private logStream;
constructor(extensionId: string, extensionVersion: string, key: string);
constructor(extensionId: string, extensionVersion: string, key: string, firstParty?: boolean);
private updateUserOptIn;

@@ -31,3 +31,3 @@ private createAppInsightsClient;

[key: string]: number;
}): void;
}, errorProps?: string[]): void;
sendTelemetryException(error: Error, properties?: {

@@ -34,0 +34,0 @@ [key: string]: string;

@@ -14,3 +14,3 @@ /*---------------------------------------------------------

// tslint:disable-next-line
function TelemetryReporter(extensionId, extensionVersion, key) {
function TelemetryReporter(extensionId, extensionVersion, key, firstParty) {
var _this = this;

@@ -21,2 +21,3 @@ this.extensionId = extensionId;

this.userOptIn = false;
this.firstParty = !!firstParty;
var logFilePath = process.env['VSCODE_LOGS'] || '';

@@ -220,6 +221,17 @@ if (logFilePath && extensionId && process.env['VSCODE_LOG_LEVEL'] === 'trace') {

};
TelemetryReporter.prototype.sendTelemetryErrorEvent = function (eventName, properties, measurements) {
TelemetryReporter.prototype.sendTelemetryErrorEvent = function (eventName, properties, measurements, errorProps) {
var _this = this;
if (this.shouldSendErrorTelemetry() && this.userOptIn && eventName && this.appInsightsClient) {
var cleanProperties = this.cloneAndChange(properties, function (prop) { return _this.anonymizeFilePaths(prop, _this.firstParty); });
if (this.userOptIn && eventName && this.appInsightsClient) {
// always clean the properties if first party
// do not send any error properties if we shouldn't send error telemetry
// if we have no errorProps, assume all are error props
var cleanProperties = this.cloneAndChange(properties, function (prop) {
if (_this.shouldSendErrorTelemetry()) {
return _this.anonymizeFilePaths(prop, _this.firstParty);
}
if (errorProps === undefined || errorProps.indexOf(prop) !== -1) {
return 'REDACTED';
}
return _this.anonymizeFilePaths(prop, _this.firstParty);
});
this.appInsightsClient.trackEvent({

@@ -226,0 +238,0 @@ name: this.extensionId + "/" + eventName,

{
"name": "vscode-extension-telemetry",
"description": "A module for first party microsoft extensions to report consistent telemetry.",
"version": "0.1.3",
"version": "0.1.4",
"author": {

@@ -6,0 +6,0 @@ "name": "Microsoft Corporation"

@@ -43,2 +43,6 @@ # [vscode-extension-telemetry](https://www.npmjs.com/package/vscode-extension-telemetry)

### First-Party
By default, we use the AppInsights key to detect whether or not the telemetry is first-party. The constructor now takes an optional parameter that will force the reporter to treat telemetry as first-party. This parameter will not override in the false direction.
## Sending Events

@@ -50,3 +54,3 @@

// send event any time after activation
reporter.sendTelemetryEvent('sampleEvent', { 'stringProp': 'some string' }, { 'numericMeasure': 123});
reporter.sendTelemetryEvent('sampleEvent', { 'stringProp': 'some string' }, { 'numericMeasure': 123 });
```

@@ -61,3 +65,3 @@

try { ... } catch (error) {
reporter.sendTelemetryException(error, { 'stringProp': 'some string' }, { 'numericMeasure': 123});
reporter.sendTelemetryException(error, { 'stringProp': 'some string' }, { 'numericMeasure': 123 });
}

@@ -68,7 +72,7 @@ ```

Use this method for sending error telemetry as traditional events to App Insights. This method will automatically drop events in certain environments for first party extensions.
Use this method for sending error telemetry as traditional events to App Insights. This method will automatically drop error properties in certain environments for first party extensions. The last parameter is an optional list of case-sensitive properties that should be dropped. If no array is passed, we will drop all properties but still send the event.
```javascript
// send an error event any time after activation
reporter.sendTelemetryErrorEvent('sampleErrorEvent', { 'stringProp': 'some string' }, { 'numericMeasure': 123});
reporter.sendTelemetryErrorEvent('sampleErrorEvent', { 'stringProp': 'some string', 'stackProp': 'some user stack trace' }, { 'numericMeasure': 123 }, [ 'stackProp' ]);
```

@@ -75,0 +79,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc