@salesforce/telemetry 3.2.24 → 3.2.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/lib/telemetryReporter.js +5 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package serves an interface for [Microsoft's Application Insights npm modul
|
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
|
-
### For long running process
|
|
11
|
+
### For long running process
|
|
12
12
|
|
|
13
13
|
```javascript
|
|
14
14
|
import TelemetryReporter from '@salesforce/telemetry';
|
|
@@ -26,11 +26,11 @@ By default, some common properties are hidden for GDPR. This is to protect clien
|
|
|
26
26
|
const reporter = await TelemetryReporter.create({
|
|
27
27
|
project: 'my-project-name',
|
|
28
28
|
key: 'my-instrumentation-key',
|
|
29
|
-
gdprSensitiveKeys: []
|
|
29
|
+
gdprSensitiveKeys: [],
|
|
30
30
|
});
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
### For short lived processes
|
|
33
|
+
### For short lived processes
|
|
34
34
|
|
|
35
35
|
```javascript
|
|
36
36
|
import TelemetryReporter from '@salesforce/telemetry';
|
|
@@ -48,4 +48,4 @@ reporter.stop();
|
|
|
48
48
|
|
|
49
49
|
## Env Variables
|
|
50
50
|
|
|
51
|
-
`
|
|
51
|
+
`SF_DISABLE_TELEMETRY`: Set to `true` if you want to disable telemetry.
|
package/lib/telemetryReporter.js
CHANGED
|
@@ -12,7 +12,6 @@ const core_1 = require("@salesforce/core");
|
|
|
12
12
|
const kit_1 = require("@salesforce/kit");
|
|
13
13
|
const axios_1 = require("axios");
|
|
14
14
|
const appInsights_1 = require("./appInsights");
|
|
15
|
-
const DISABLE_TELEMETRY = 'disableTelemetry';
|
|
16
15
|
var appInsights_2 = require("./appInsights");
|
|
17
16
|
Object.defineProperty(exports, "TelemetryClient", { enumerable: true, get: function () { return appInsights_2.TelemetryClient; } });
|
|
18
17
|
/**
|
|
@@ -31,7 +30,8 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
|
|
|
31
30
|
if (!TelemetryReporter.config) {
|
|
32
31
|
TelemetryReporter.config = await core_1.SfdxConfigAggregator.create({});
|
|
33
32
|
}
|
|
34
|
-
const configValue = TelemetryReporter.config.getPropertyValue(DISABLE_TELEMETRY);
|
|
33
|
+
const configValue = TelemetryReporter.config.getPropertyValue(core_1.SfConfigProperties.DISABLE_TELEMETRY);
|
|
34
|
+
// SF_DISABLE_TELEMETRY is the proper name for this env that will be cheked by config.getPropertyValue. SFDX_DISABLE_INSIGHTS is present for backwards compatibility
|
|
35
35
|
const sfdxDisableInsights = configValue === 'true' || kit_1.env.getBoolean('SFDX_DISABLE_INSIGHTS');
|
|
36
36
|
return !sfdxDisableInsights;
|
|
37
37
|
}
|
|
@@ -147,7 +147,7 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
|
|
|
147
147
|
* Setting the disableTelemetry config var to true will disable insights for errors and diagnostics.
|
|
148
148
|
*/
|
|
149
149
|
isSfdxTelemetryEnabled() {
|
|
150
|
-
const configValue = this.config.getPropertyValue(DISABLE_TELEMETRY);
|
|
150
|
+
const configValue = this.config.getPropertyValue(core_1.SfConfigProperties.DISABLE_TELEMETRY);
|
|
151
151
|
const sfdxDisableInsights = configValue === 'true' || kit_1.env.getBoolean('SFDX_DISABLE_INSIGHTS');
|
|
152
152
|
// isEnabled = !sfdxDisableInsights
|
|
153
153
|
return !sfdxDisableInsights;
|
|
@@ -155,10 +155,10 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
|
|
|
155
155
|
logTelemetryStatus() {
|
|
156
156
|
const isEnabled = this.isSfdxTelemetryEnabled();
|
|
157
157
|
if (isEnabled) {
|
|
158
|
-
this.logger.warn(`Telemetry is enabled. This can be disabled by running sfdx force:config:set ${DISABLE_TELEMETRY}=true`);
|
|
158
|
+
this.logger.warn(`Telemetry is enabled. This can be disabled by running sfdx force:config:set ${core_1.SfConfigProperties.DISABLE_TELEMETRY}=true`);
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
|
-
this.logger.warn(`Telemetry is disabled. This can be enabled by running sfdx force:config:set ${DISABLE_TELEMETRY}=false`);
|
|
161
|
+
this.logger.warn(`Telemetry is disabled. This can be enabled by running sfdx force:config:set ${core_1.SfConfigProperties.DISABLE_TELEMETRY}=false`);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/telemetry",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.25",
|
|
4
4
|
"description": "Library for application insights",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"repository": "forcedotcom/telemetry",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"eslint-config-salesforce-typescript": "^1.1.1",
|
|
54
54
|
"eslint-plugin-header": "^3.0.0",
|
|
55
55
|
"eslint-plugin-import": "2.27.5",
|
|
56
|
-
"eslint-plugin-jsdoc": "^40.
|
|
56
|
+
"eslint-plugin-jsdoc": "^40.3.0",
|
|
57
57
|
"husky": "^8.0.3",
|
|
58
58
|
"mocha": "^10.2.0",
|
|
59
59
|
"nyc": "^15.1.0",
|