@sap-ux/telemetry 1.0.11 → 1.0.13
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.
|
@@ -62,7 +62,7 @@ declare class ApplicationInsightClient extends Client {
|
|
|
62
62
|
*/
|
|
63
63
|
private trackEventBlocking;
|
|
64
64
|
/**
|
|
65
|
-
* Send
|
|
65
|
+
* Send telemetry event in non-blocking fashion.
|
|
66
66
|
*
|
|
67
67
|
* @param client Telemetry client instance
|
|
68
68
|
* @param event Telemetry event
|
|
@@ -104,23 +104,13 @@ class ApplicationInsightClient extends Client {
|
|
|
104
104
|
* @returns Promise<void>
|
|
105
105
|
*/
|
|
106
106
|
async trackEventBlocking(client, event) {
|
|
107
|
-
if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY
|
|
108
|
-
|
|
107
|
+
if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY !== 'true') {
|
|
108
|
+
client.trackEvent(event);
|
|
109
|
+
await client.flush();
|
|
109
110
|
}
|
|
110
|
-
return new Promise((resolve, reject) => {
|
|
111
|
-
try {
|
|
112
|
-
client.trackEvent(event);
|
|
113
|
-
client.flush({
|
|
114
|
-
callback: () => resolve()
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
reject(error);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
111
|
}
|
|
122
112
|
/**
|
|
123
|
-
* Send
|
|
113
|
+
* Send telemetry event in non-blocking fashion.
|
|
124
114
|
*
|
|
125
115
|
* @param client Telemetry client instance
|
|
126
116
|
* @param event Telemetry event
|
|
@@ -140,21 +130,21 @@ class ApplicationInsightClient extends Client {
|
|
|
140
130
|
* @returns Telemetry client instance
|
|
141
131
|
*/
|
|
142
132
|
createTelemetryClient(sampleRate) {
|
|
143
|
-
let
|
|
133
|
+
let sampleRateNumber;
|
|
144
134
|
switch (sampleRate) {
|
|
145
135
|
case SampleRate.OnePercent:
|
|
146
|
-
|
|
136
|
+
sampleRateNumber = 1;
|
|
147
137
|
break;
|
|
148
138
|
case SampleRate.TenPercent:
|
|
149
|
-
|
|
139
|
+
sampleRateNumber = 10;
|
|
150
140
|
break;
|
|
151
141
|
case SampleRate.NoSampling:
|
|
152
142
|
default:
|
|
153
|
-
|
|
143
|
+
sampleRateNumber = 100;
|
|
154
144
|
break;
|
|
155
145
|
}
|
|
156
146
|
const client = new appInsights.TelemetryClient(this.applicationKey);
|
|
157
|
-
client.config.samplingPercentage =
|
|
147
|
+
client.config.samplingPercentage = sampleRateNumber;
|
|
158
148
|
configAzureTelemetryClient(client);
|
|
159
149
|
return client;
|
|
160
150
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// import type { TelemetryItem } from 'applicationinsights'; // not exported
|
|
1
2
|
/**
|
|
2
3
|
* Enable local caching of telemetry data when offline.
|
|
3
4
|
* Disable GDPR private data that are collected by Azure AppInsight client.
|
|
@@ -5,8 +6,11 @@
|
|
|
5
6
|
* @param client Azure App Insights telemetry client instance
|
|
6
7
|
*/
|
|
7
8
|
export function configAzureTelemetryClient(client) {
|
|
8
|
-
client.
|
|
9
|
-
|
|
9
|
+
if (client.setUseDiskRetryCaching) {
|
|
10
|
+
client.setUseDiskRetryCaching(true);
|
|
11
|
+
}
|
|
12
|
+
client.addTelemetryProcessor((envelope /* TelemetryItem */) => {
|
|
13
|
+
envelope.tags ??= {};
|
|
10
14
|
envelope.tags['ai.location.ip'] = '0.0.0.0';
|
|
11
15
|
envelope.tags['ai.cloud.roleInstance'] = 'masked';
|
|
12
16
|
envelope.tags['ai.cloud.role'] = 'masked';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/telemetry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Library for sending usage telemetry data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"private": false,
|
|
16
16
|
"main": "dist/index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"applicationinsights": "
|
|
18
|
+
"applicationinsights": "3.15.0",
|
|
19
19
|
"axios": "1.16.0",
|
|
20
20
|
"performance-now": "2.1.0",
|
|
21
21
|
"yaml": "2.8.3",
|
|
22
22
|
"@sap-ux/store": "2.0.2",
|
|
23
|
-
"@sap-ux/project-access": "2.1.
|
|
23
|
+
"@sap-ux/project-access": "2.1.4",
|
|
24
24
|
"@sap-ux/btp-utils": "2.0.3",
|
|
25
25
|
"@sap-ux/ui5-config": "1.0.3",
|
|
26
26
|
"@sap-ux/logger": "1.0.1",
|