@sap-ux/telemetry 0.2.0
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/LICENSE +201 -0
- package/README.md +27 -0
- package/dist/base/client/azure-appinsight-client.d.ts +88 -0
- package/dist/base/client/azure-appinsight-client.js +195 -0
- package/dist/base/client/client.d.ts +24 -0
- package/dist/base/client/client.js +33 -0
- package/dist/base/client/index.d.ts +24 -0
- package/dist/base/client/index.js +38 -0
- package/dist/base/config-state.d.ts +12 -0
- package/dist/base/config-state.js +26 -0
- package/dist/base/decorator/index.d.ts +23 -0
- package/dist/base/decorator/index.js +41 -0
- package/dist/base/interceptor/config.d.ts +19 -0
- package/dist/base/interceptor/config.js +54 -0
- package/dist/base/interceptor/index.d.ts +10 -0
- package/dist/base/interceptor/index.js +90 -0
- package/dist/base/performance/api.d.ts +74 -0
- package/dist/base/performance/api.js +120 -0
- package/dist/base/performance/entries.d.ts +42 -0
- package/dist/base/performance/entries.js +53 -0
- package/dist/base/performance/types.d.ts +35 -0
- package/dist/base/performance/types.js +17 -0
- package/dist/base/types/event-header.d.ts +28 -0
- package/dist/base/types/event-header.js +38 -0
- package/dist/base/types/event-name.d.ts +6 -0
- package/dist/base/types/event-name.js +10 -0
- package/dist/base/types/index.d.ts +5 -0
- package/dist/base/types/index.js +21 -0
- package/dist/base/types/project-info.d.ts +5 -0
- package/dist/base/types/project-info.js +3 -0
- package/dist/base/types/sample-rate.d.ts +6 -0
- package/dist/base/types/sample-rate.js +10 -0
- package/dist/base/utils/azure-client-config.d.ts +9 -0
- package/dist/base/utils/azure-client-config.js +21 -0
- package/dist/base/utils/date.d.ts +2 -0
- package/dist/base/utils/date.js +9 -0
- package/dist/base/utils/index.d.ts +6 -0
- package/dist/base/utils/index.js +24 -0
- package/dist/base/utils/logger.d.ts +6 -0
- package/dist/base/utils/logger.js +10 -0
- package/dist/base/utils/param-processing.d.ts +46 -0
- package/dist/base/utils/param-processing.js +103 -0
- package/dist/base/utils/reporting.d.ts +3 -0
- package/dist/base/utils/reporting.js +101 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +35 -0
- package/dist/tooling-telemetry/config-state.d.ts +4 -0
- package/dist/tooling-telemetry/config-state.js +7 -0
- package/dist/tooling-telemetry/data-processor.d.ts +23 -0
- package/dist/tooling-telemetry/data-processor.js +354 -0
- package/dist/tooling-telemetry/index.d.ts +5 -0
- package/dist/tooling-telemetry/index.js +23 -0
- package/dist/tooling-telemetry/telemetry-client.d.ts +65 -0
- package/dist/tooling-telemetry/telemetry-client.js +118 -0
- package/dist/tooling-telemetry/telemetry-settings.d.ts +22 -0
- package/dist/tooling-telemetry/telemetry-settings.js +180 -0
- package/dist/tooling-telemetry/types.d.ts +92 -0
- package/dist/tooling-telemetry/types.js +40 -0
- package/package.json +60 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventName = void 0;
|
|
4
|
+
var EventName;
|
|
5
|
+
(function (EventName) {
|
|
6
|
+
EventName["Test"] = "test";
|
|
7
|
+
EventName["TELEMETRY_SETTINGS_INIT_FAILED"] = "TELEMETRY_SETTINGS_INIT_FAILED";
|
|
8
|
+
EventName["DISABLE_TELEMETRY"] = "DISABLE_TELEMETRY";
|
|
9
|
+
})(EventName = exports.EventName || (exports.EventName = {}));
|
|
10
|
+
//# sourceMappingURL=event-name.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./event-header"), exports);
|
|
18
|
+
__exportStar(require("./event-name"), exports);
|
|
19
|
+
__exportStar(require("./project-info"), exports);
|
|
20
|
+
__exportStar(require("./sample-rate"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SampleRate = void 0;
|
|
4
|
+
var SampleRate;
|
|
5
|
+
(function (SampleRate) {
|
|
6
|
+
SampleRate[SampleRate["OnePercent"] = 0] = "OnePercent";
|
|
7
|
+
SampleRate[SampleRate["TenPercent"] = 1] = "TenPercent";
|
|
8
|
+
SampleRate[SampleRate["NoSampling"] = 2] = "NoSampling";
|
|
9
|
+
})(SampleRate = exports.SampleRate || (exports.SampleRate = {}));
|
|
10
|
+
//# sourceMappingURL=sample-rate.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TelemetryClient as AzureTelemetryClient } from 'applicationinsights';
|
|
2
|
+
/**
|
|
3
|
+
* Enable local caching of telemetry data when offline.
|
|
4
|
+
* Disable GDPR private data that are collected by Azure AppInsight client.
|
|
5
|
+
*
|
|
6
|
+
* @param client Azure App Insights telemetry client instance
|
|
7
|
+
*/
|
|
8
|
+
export declare function configAzureTelemetryClient(client: AzureTelemetryClient): void;
|
|
9
|
+
//# sourceMappingURL=azure-client-config.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configAzureTelemetryClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enable local caching of telemetry data when offline.
|
|
6
|
+
* Disable GDPR private data that are collected by Azure AppInsight client.
|
|
7
|
+
*
|
|
8
|
+
* @param client Azure App Insights telemetry client instance
|
|
9
|
+
*/
|
|
10
|
+
function configAzureTelemetryClient(client) {
|
|
11
|
+
client.channel.setUseDiskRetryCaching(true);
|
|
12
|
+
client.addTelemetryProcessor((envelope) => {
|
|
13
|
+
envelope.tags['ai.location.ip'] = '0.0.0.0';
|
|
14
|
+
envelope.tags['ai.cloud.roleInstance'] = 'masked';
|
|
15
|
+
envelope.tags['ai.cloud.role'] = 'masked';
|
|
16
|
+
envelope.tags['ai.device.type'] = 'masked';
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.configAzureTelemetryClient = configAzureTelemetryClient;
|
|
21
|
+
//# sourceMappingURL=azure-client-config.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localDatetimeToUTC = void 0;
|
|
4
|
+
const localDatetimeToUTC = () => {
|
|
5
|
+
const timeInMs = new Date().getTime();
|
|
6
|
+
return new Date(timeInMs).toISOString();
|
|
7
|
+
};
|
|
8
|
+
exports.localDatetimeToUTC = localDatetimeToUTC;
|
|
9
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.configAzureTelemetryClient = void 0;
|
|
18
|
+
var azure_client_config_1 = require("./azure-client-config");
|
|
19
|
+
Object.defineProperty(exports, "configAzureTelemetryClient", { enumerable: true, get: function () { return azure_client_config_1.configAzureTelemetryClient; } });
|
|
20
|
+
__exportStar(require("./date"), exports);
|
|
21
|
+
__exportStar(require("./logger"), exports);
|
|
22
|
+
__exportStar(require("./param-processing"), exports);
|
|
23
|
+
__exportStar(require("./reporting"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultLogger = void 0;
|
|
4
|
+
const logger_1 = require("@sap-ux/logger");
|
|
5
|
+
/**
|
|
6
|
+
* @returns {Logger} console logger
|
|
7
|
+
*/
|
|
8
|
+
const getDefaultLogger = () => new logger_1.ToolsLogger({ transports: [new logger_1.ConsoleTransport()] });
|
|
9
|
+
exports.getDefaultLogger = getDefaultLogger;
|
|
10
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
type instruction = ParamRecordConfigField | string | undefined;
|
|
2
|
+
export type dimensions = {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export type measurements = {
|
|
6
|
+
[key: string]: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* ParamRecordConfigField
|
|
10
|
+
*/
|
|
11
|
+
export declare class ParamRecordConfigField {
|
|
12
|
+
path: string;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param path input path
|
|
16
|
+
*/
|
|
17
|
+
constructor(path: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare class ParamRecordConfig {
|
|
23
|
+
key: string | undefined;
|
|
24
|
+
value: instruction;
|
|
25
|
+
paramIndex: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param key - string or undefined;
|
|
29
|
+
* When string set as key of new field;
|
|
30
|
+
* When undefined key of new field set to - 'data';
|
|
31
|
+
* @param value - instance of ParamRecordConfigField, string or undefined;
|
|
32
|
+
* When instance of ParamRecordConfigField data gets extracted from specified path of parameter under index specified in @param paramIndex;
|
|
33
|
+
* When string set as value of new field;
|
|
34
|
+
* When undefined - new fields value being set as parameter under index of @param paramIndex;
|
|
35
|
+
* @param paramIndex - optional, number or undefined;
|
|
36
|
+
* When number - speicifes index of parameter to capture or extract data from;
|
|
37
|
+
* Set to undefined when want to use strin passed as @param value as new fields value;
|
|
38
|
+
*/
|
|
39
|
+
constructor(key?: string | undefined, value?: instruction, paramIndex?: number | undefined);
|
|
40
|
+
}
|
|
41
|
+
export declare const wrongPathErr: (field: string, index: number) => Error;
|
|
42
|
+
export declare const getValue: (obj: any, path: string, field: string, paramIndex: number) => number | string;
|
|
43
|
+
export declare const paramsProcessing: (params: any, instructions: ParamRecordConfig) => [dimensions, measurements];
|
|
44
|
+
export declare const getParamsData: (params: any, instructions: ParamRecordConfig[] | ParamRecordConfig) => [dimensions, measurements];
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=param-processing.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParamsData = exports.paramsProcessing = exports.getValue = exports.wrongPathErr = exports.ParamRecordConfig = exports.ParamRecordConfigField = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ParamRecordConfigField
|
|
6
|
+
*/
|
|
7
|
+
class ParamRecordConfigField {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param path input path
|
|
11
|
+
*/
|
|
12
|
+
constructor(path) {
|
|
13
|
+
this.path = path;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ParamRecordConfigField = ParamRecordConfigField;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
class ParamRecordConfig {
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param key - string or undefined;
|
|
24
|
+
* When string set as key of new field;
|
|
25
|
+
* When undefined key of new field set to - 'data';
|
|
26
|
+
* @param value - instance of ParamRecordConfigField, string or undefined;
|
|
27
|
+
* When instance of ParamRecordConfigField data gets extracted from specified path of parameter under index specified in @param paramIndex;
|
|
28
|
+
* When string set as value of new field;
|
|
29
|
+
* When undefined - new fields value being set as parameter under index of @param paramIndex;
|
|
30
|
+
* @param paramIndex - optional, number or undefined;
|
|
31
|
+
* When number - speicifes index of parameter to capture or extract data from;
|
|
32
|
+
* Set to undefined when want to use strin passed as @param value as new fields value;
|
|
33
|
+
*/
|
|
34
|
+
constructor(key = undefined, value = undefined, paramIndex = undefined) {
|
|
35
|
+
this.key = key;
|
|
36
|
+
this.value = value;
|
|
37
|
+
this.paramIndex = paramIndex;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ParamRecordConfig = ParamRecordConfig;
|
|
41
|
+
const wrongPathErr = (field, index) => new Error(`Wrong path for '${field}' field is specified in instructions with index - ${index}`);
|
|
42
|
+
exports.wrongPathErr = wrongPathErr;
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
const getValue = (obj, path, field, paramIndex) => {
|
|
45
|
+
const pathArr = path.split('/');
|
|
46
|
+
let node = obj, i = 0;
|
|
47
|
+
while (i < pathArr.length) {
|
|
48
|
+
node = node[pathArr[i]];
|
|
49
|
+
if (node === undefined) {
|
|
50
|
+
throw (0, exports.wrongPathErr)(field, paramIndex);
|
|
51
|
+
}
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
return node;
|
|
55
|
+
};
|
|
56
|
+
exports.getValue = getValue;
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
const paramsProcessing = (params, instructions) => {
|
|
59
|
+
const processedDimensions = {};
|
|
60
|
+
const processedMeasurements = {};
|
|
61
|
+
let param = null; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
62
|
+
if (instructions.paramIndex !== undefined) {
|
|
63
|
+
param = params[instructions.paramIndex];
|
|
64
|
+
}
|
|
65
|
+
const key = instructions.key ? instructions.key : 'data';
|
|
66
|
+
let val = '';
|
|
67
|
+
if (typeof instructions.value === 'string') {
|
|
68
|
+
val = instructions.value;
|
|
69
|
+
}
|
|
70
|
+
else if (instructions.value !== undefined && instructions.paramIndex !== undefined) {
|
|
71
|
+
val = (0, exports.getValue)(param, instructions.value.path, 'val', instructions.paramIndex);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
val = param;
|
|
75
|
+
}
|
|
76
|
+
if (!isNaN(val)) {
|
|
77
|
+
processedMeasurements[key] = val;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
processedDimensions[key] = val;
|
|
81
|
+
}
|
|
82
|
+
return [processedDimensions, processedMeasurements];
|
|
83
|
+
};
|
|
84
|
+
exports.paramsProcessing = paramsProcessing;
|
|
85
|
+
const getParamsData = (params, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
86
|
+
instructions) => {
|
|
87
|
+
let processedDimensions, processedMeasurements;
|
|
88
|
+
let customDimensions = {};
|
|
89
|
+
let customMeasurements = {};
|
|
90
|
+
if (Array.isArray(instructions)) {
|
|
91
|
+
for (const instruction of instructions) {
|
|
92
|
+
[processedDimensions, processedMeasurements] = (0, exports.paramsProcessing)(params, instruction);
|
|
93
|
+
customDimensions = Object.assign(Object.assign({}, customDimensions), processedDimensions);
|
|
94
|
+
customMeasurements = Object.assign(Object.assign({}, customMeasurements), processedMeasurements);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
[customDimensions, customMeasurements] = (0, exports.paramsProcessing)(params, instructions);
|
|
99
|
+
}
|
|
100
|
+
return [customDimensions, customMeasurements];
|
|
101
|
+
};
|
|
102
|
+
exports.getParamsData = getParamsData;
|
|
103
|
+
//# sourceMappingURL=param-processing.js.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.reportEnableTelemetryOnOff = exports.reportRuntimeError = void 0;
|
|
27
|
+
const appInsights = __importStar(require("applicationinsights"));
|
|
28
|
+
const azure_client_config_1 = require("./azure-client-config");
|
|
29
|
+
const config_state_1 = require("../config-state");
|
|
30
|
+
const types_1 = require("../types");
|
|
31
|
+
const parseErrorStack = (errorStack) => {
|
|
32
|
+
const regexps = [/sap-ux.+/gi, /[a-zA-Z-]+\/ide-extension\/.+/gi, /(\/telemetry\/.+)/gi];
|
|
33
|
+
const parsedStack = [];
|
|
34
|
+
const filtered = errorStack.split('\n').filter((line) => !!/^\s*at .*(\S+:\d+|\(native\))/m.exec(line));
|
|
35
|
+
if (!filtered.length) {
|
|
36
|
+
return parsedStack;
|
|
37
|
+
}
|
|
38
|
+
filtered.forEach((line) => {
|
|
39
|
+
let sanitizedLine = line.replace(/^\s+/, '');
|
|
40
|
+
const lineRegexp = / (\((.+):(\d+):(\d+)\)$)/;
|
|
41
|
+
const location = lineRegexp.exec(line);
|
|
42
|
+
if (!location) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let filepath = null;
|
|
46
|
+
const normalizedFilepath = location[2].replace(/\\/g, '/');
|
|
47
|
+
for (const regexp of regexps) {
|
|
48
|
+
const match = regexp.exec(normalizedFilepath);
|
|
49
|
+
if (match) {
|
|
50
|
+
filepath = match[0];
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!filepath) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
sanitizedLine = sanitizedLine.replace(location[0], '');
|
|
58
|
+
const functionName = sanitizedLine.split(/\s+/).slice(1).join('');
|
|
59
|
+
const lineNumber = location[3];
|
|
60
|
+
const columnNumber = location[4];
|
|
61
|
+
const parsedStackLine = `${functionName} at (${filepath}:${lineNumber}:${columnNumber});`;
|
|
62
|
+
parsedStack.push(parsedStackLine);
|
|
63
|
+
});
|
|
64
|
+
return parsedStack;
|
|
65
|
+
};
|
|
66
|
+
let reportingTelemetryClient;
|
|
67
|
+
const reportRuntimeError = (error) => {
|
|
68
|
+
var _a;
|
|
69
|
+
if (((_a = process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY) === null || _a === void 0 ? void 0 : _a.trim()) !== 'true') {
|
|
70
|
+
reportingTelemetryClient = new appInsights.TelemetryClient(config_state_1.TelemetrySettings.azureInstrumentationKey);
|
|
71
|
+
(0, azure_client_config_1.configAzureTelemetryClient)(reportingTelemetryClient);
|
|
72
|
+
}
|
|
73
|
+
const properties = { message: error.message };
|
|
74
|
+
if (error.stack) {
|
|
75
|
+
const parsedStack = parseErrorStack(error.stack);
|
|
76
|
+
if (parsedStack.length) {
|
|
77
|
+
properties.stack = parsedStack.join(' \n');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const telemetryEvent = {
|
|
81
|
+
name: types_1.EventName.TELEMETRY_SETTINGS_INIT_FAILED,
|
|
82
|
+
properties,
|
|
83
|
+
measurements: {}
|
|
84
|
+
};
|
|
85
|
+
if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY !== 'true') {
|
|
86
|
+
reportingTelemetryClient.trackEvent(telemetryEvent);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
exports.reportRuntimeError = reportRuntimeError;
|
|
90
|
+
const reportEnableTelemetryOnOff = (enableTelemetry, commonProperties) => {
|
|
91
|
+
const telemetryEvent = {
|
|
92
|
+
name: types_1.EventName.DISABLE_TELEMETRY,
|
|
93
|
+
properties: Object.assign({ disableTelemetry: `${!enableTelemetry}` }, commonProperties),
|
|
94
|
+
measurements: {}
|
|
95
|
+
};
|
|
96
|
+
if (process.env.SAP_UX_FIORI_TOOLS_DISABLE_TELEMETRY !== 'true') {
|
|
97
|
+
reportingTelemetryClient.trackEvent(telemetryEvent);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.reportEnableTelemetryOnOff = reportEnableTelemetryOnOff;
|
|
101
|
+
//# sourceMappingURL=reporting.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ClientFactory } from './base/client/index';
|
|
2
|
+
export { Client } from './base/client/client';
|
|
3
|
+
export { ApplicationInsightClient } from './base/client/azure-appinsight-client';
|
|
4
|
+
export { EventHeader } from './base/types/event-header';
|
|
5
|
+
export { EventName } from './base/types/event-name';
|
|
6
|
+
export { SampleRate } from './base/types/sample-rate';
|
|
7
|
+
export { initTelemetrySettings, setEnableTelemetry, getTelemetrySetting, ToolsSuiteTelemetryClient, TelemetryHelperProperties, TelemetryEvent, TelemetryMeasurements, TelemetryProperties, ToolsId } from './tooling-telemetry';
|
|
8
|
+
export { InterceptorTypes } from './base/interceptor/config';
|
|
9
|
+
export { PerformanceMeasurementAPI } from './base/performance/api';
|
|
10
|
+
export { ParamRecordConfig, ParamRecordConfigField } from './base/utils/param-processing';
|
|
11
|
+
export { logTelemetry, logTelemetryAsync } from './base/decorator';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logTelemetryAsync = exports.logTelemetry = exports.ParamRecordConfigField = exports.ParamRecordConfig = exports.PerformanceMeasurementAPI = exports.InterceptorTypes = exports.ToolsId = exports.ToolsSuiteTelemetryClient = exports.getTelemetrySetting = exports.setEnableTelemetry = exports.initTelemetrySettings = exports.SampleRate = exports.EventName = exports.EventHeader = exports.ApplicationInsightClient = exports.Client = exports.ClientFactory = void 0;
|
|
4
|
+
/* Types and classes */
|
|
5
|
+
var index_1 = require("./base/client/index");
|
|
6
|
+
Object.defineProperty(exports, "ClientFactory", { enumerable: true, get: function () { return index_1.ClientFactory; } });
|
|
7
|
+
var client_1 = require("./base/client/client");
|
|
8
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
9
|
+
var azure_appinsight_client_1 = require("./base/client/azure-appinsight-client");
|
|
10
|
+
Object.defineProperty(exports, "ApplicationInsightClient", { enumerable: true, get: function () { return azure_appinsight_client_1.ApplicationInsightClient; } });
|
|
11
|
+
var event_header_1 = require("./base/types/event-header");
|
|
12
|
+
Object.defineProperty(exports, "EventHeader", { enumerable: true, get: function () { return event_header_1.EventHeader; } });
|
|
13
|
+
var event_name_1 = require("./base/types/event-name");
|
|
14
|
+
Object.defineProperty(exports, "EventName", { enumerable: true, get: function () { return event_name_1.EventName; } });
|
|
15
|
+
var sample_rate_1 = require("./base/types/sample-rate");
|
|
16
|
+
Object.defineProperty(exports, "SampleRate", { enumerable: true, get: function () { return sample_rate_1.SampleRate; } });
|
|
17
|
+
/* API for most common use cases */
|
|
18
|
+
var tooling_telemetry_1 = require("./tooling-telemetry");
|
|
19
|
+
Object.defineProperty(exports, "initTelemetrySettings", { enumerable: true, get: function () { return tooling_telemetry_1.initTelemetrySettings; } });
|
|
20
|
+
Object.defineProperty(exports, "setEnableTelemetry", { enumerable: true, get: function () { return tooling_telemetry_1.setEnableTelemetry; } });
|
|
21
|
+
Object.defineProperty(exports, "getTelemetrySetting", { enumerable: true, get: function () { return tooling_telemetry_1.getTelemetrySetting; } });
|
|
22
|
+
Object.defineProperty(exports, "ToolsSuiteTelemetryClient", { enumerable: true, get: function () { return tooling_telemetry_1.ToolsSuiteTelemetryClient; } });
|
|
23
|
+
Object.defineProperty(exports, "ToolsId", { enumerable: true, get: function () { return tooling_telemetry_1.ToolsId; } });
|
|
24
|
+
/* Decorator and measurements utils */
|
|
25
|
+
var config_1 = require("./base/interceptor/config");
|
|
26
|
+
Object.defineProperty(exports, "InterceptorTypes", { enumerable: true, get: function () { return config_1.InterceptorTypes; } });
|
|
27
|
+
var api_1 = require("./base/performance/api");
|
|
28
|
+
Object.defineProperty(exports, "PerformanceMeasurementAPI", { enumerable: true, get: function () { return api_1.PerformanceMeasurementAPI; } });
|
|
29
|
+
var param_processing_1 = require("./base/utils/param-processing");
|
|
30
|
+
Object.defineProperty(exports, "ParamRecordConfig", { enumerable: true, get: function () { return param_processing_1.ParamRecordConfig; } });
|
|
31
|
+
Object.defineProperty(exports, "ParamRecordConfigField", { enumerable: true, get: function () { return param_processing_1.ParamRecordConfigField; } });
|
|
32
|
+
var decorator_1 = require("./base/decorator");
|
|
33
|
+
Object.defineProperty(exports, "logTelemetry", { enumerable: true, get: function () { return decorator_1.logTelemetry; } });
|
|
34
|
+
Object.defineProperty(exports, "logTelemetryAsync", { enumerable: true, get: function () { return decorator_1.logTelemetryAsync; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CommonFioriProjectProperties } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Collect commone properties that needs to be added to telemetry event.
|
|
4
|
+
*
|
|
5
|
+
* @param telemetryHelperProperties Pass to report ApplicationInsightClient.report()
|
|
6
|
+
* @returns Common Fiori project properties
|
|
7
|
+
*/
|
|
8
|
+
export declare function processToolsSuiteTelemetry(telemetryHelperProperties: Record<string, string> | undefined): Promise<CommonFioriProjectProperties>;
|
|
9
|
+
/**
|
|
10
|
+
* Get common properties that related to Fiori project runtime environment.
|
|
11
|
+
*
|
|
12
|
+
* @returns Common properties
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCommonProperties(): Promise<CommonFioriProjectProperties>;
|
|
15
|
+
/**
|
|
16
|
+
* Spawn a command to find out node.js version used for the runtime.
|
|
17
|
+
*
|
|
18
|
+
* @param command command name
|
|
19
|
+
* @param commandArgs command arguments
|
|
20
|
+
* @returns Node.js version
|
|
21
|
+
*/
|
|
22
|
+
export declare function spawnCommand(command: string, commandArgs: string[]): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=data-processor.d.ts.map
|