@salesforce/telemetry 6.1.0 → 6.1.1
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/lib/o11yReporter.js +10 -0
- package/package.json +2 -2
package/lib/o11yReporter.js
CHANGED
|
@@ -26,11 +26,15 @@ class O11yReporter extends baseReporter_1.BaseReporter {
|
|
|
26
26
|
await this.initialized;
|
|
27
27
|
}
|
|
28
28
|
async sendTelemetryEvent(eventName, attributes = {}) {
|
|
29
|
+
// Wait for initialization to complete before using the service
|
|
30
|
+
await this.initialized;
|
|
29
31
|
const merged = { ...this.commonProperties, ...attributes };
|
|
30
32
|
this.service.logEvent({ eventName: `${this.extensionName}/${eventName}`, ...merged });
|
|
31
33
|
await this.service.upload();
|
|
32
34
|
}
|
|
33
35
|
async flush() {
|
|
36
|
+
// Wait for initialization to complete before using the service
|
|
37
|
+
await this.initialized;
|
|
34
38
|
await this.service.upload();
|
|
35
39
|
}
|
|
36
40
|
/**
|
|
@@ -40,6 +44,8 @@ class O11yReporter extends baseReporter_1.BaseReporter {
|
|
|
40
44
|
* @param attributes {Attributes} - map of measurements to publish alongside the exception.
|
|
41
45
|
*/
|
|
42
46
|
async sendTelemetryException(exception, attributes = {}) {
|
|
47
|
+
// Wait for initialization to complete before using the service
|
|
48
|
+
await this.initialized;
|
|
43
49
|
const cleanException = this.sanitizeError(exception);
|
|
44
50
|
const { properties, measurements } = (0, utils_1.buildPropertiesAndMeasurements)(attributes);
|
|
45
51
|
// Create exception event with sanitized error information
|
|
@@ -61,6 +67,8 @@ class O11yReporter extends baseReporter_1.BaseReporter {
|
|
|
61
67
|
* @param properties {Properties} - map of properties to publish alongside the event.
|
|
62
68
|
*/
|
|
63
69
|
async sendTelemetryTrace(traceMessage, properties) {
|
|
70
|
+
// Wait for initialization to complete before using the service
|
|
71
|
+
await this.initialized;
|
|
64
72
|
const traceEvent = {
|
|
65
73
|
eventName: 'trace',
|
|
66
74
|
message: traceMessage,
|
|
@@ -77,6 +85,8 @@ class O11yReporter extends baseReporter_1.BaseReporter {
|
|
|
77
85
|
* @param properties {Properties} - map of properties to publish alongside the event.
|
|
78
86
|
*/
|
|
79
87
|
async sendTelemetryMetric(metricName, value, properties) {
|
|
88
|
+
// Wait for initialization to complete before using the service
|
|
89
|
+
await this.initialized;
|
|
80
90
|
const metricEvent = {
|
|
81
91
|
eventName: 'metric',
|
|
82
92
|
metricName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/telemetry",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Library for telemetry reporting to Application Insights and O11y",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"exports": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@salesforce/core": "^8.8.0",
|
|
45
45
|
"@salesforce/kit": "^3.2.3",
|
|
46
|
-
"@salesforce/o11y-reporter": "1.1.
|
|
46
|
+
"@salesforce/o11y-reporter": "1.1.2",
|
|
47
47
|
"applicationinsights": "^2.9.6",
|
|
48
48
|
"got": "^11",
|
|
49
49
|
"proxy-agent": "^6.5.0"
|