@azure/monitor-opentelemetry 1.20.0 → 1.20.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/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +14 -18
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/logs/handler.d.ts +2 -1
- package/dist/commonjs/logs/handler.d.ts.map +1 -1
- package/dist/commonjs/logs/handler.js +10 -5
- package/dist/commonjs/logs/handler.js.map +1 -1
- package/dist/commonjs/metrics/quickpulse/export/sender.d.ts +1 -1
- package/dist/commonjs/metrics/quickpulse/export/sender.d.ts.map +1 -1
- package/dist/commonjs/metrics/quickpulse/export/sender.js +21 -16
- package/dist/commonjs/metrics/quickpulse/export/sender.js.map +1 -1
- package/dist/commonjs/metrics/quickpulse/liveMetrics.d.ts +5 -1
- package/dist/commonjs/metrics/quickpulse/liveMetrics.d.ts.map +1 -1
- package/dist/commonjs/metrics/quickpulse/liveMetrics.js +86 -75
- package/dist/commonjs/metrics/quickpulse/liveMetrics.js.map +1 -1
- package/dist/commonjs/package.json +1 -1
- package/dist/commonjs/traces/azureSdkInstrumentation.d.ts +12 -0
- package/dist/commonjs/traces/azureSdkInstrumentation.d.ts.map +1 -0
- package/dist/commonjs/traces/azureSdkInstrumentation.js +64 -0
- package/dist/commonjs/traces/azureSdkInstrumentation.js.map +1 -0
- package/dist/commonjs/traces/handler.d.ts +2 -13
- package/dist/commonjs/traces/handler.d.ts.map +1 -1
- package/dist/commonjs/traces/handler.js +13 -36
- package/dist/commonjs/traces/handler.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/types.d.ts +1 -1
- package/dist/commonjs/types.js +1 -1
- package/dist/commonjs/types.js.map +1 -1
- package/dist/commonjs/utils/azureSdkTracingBridge.d.ts +4 -4
- package/dist/commonjs/utils/azureSdkTracingBridge.d.ts.map +1 -1
- package/dist/commonjs/utils/azureSdkTracingBridge.js +10 -8
- package/dist/commonjs/utils/azureSdkTracingBridge.js.map +1 -1
- package/dist/commonjs/utils/instrumentation.d.ts +8 -0
- package/dist/commonjs/utils/instrumentation.d.ts.map +1 -0
- package/dist/commonjs/utils/instrumentation.js +26 -0
- package/dist/commonjs/utils/instrumentation.js.map +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logs/handler.d.ts +2 -1
- package/dist/esm/logs/handler.d.ts.map +1 -1
- package/dist/esm/logs/handler.js +10 -5
- package/dist/esm/logs/handler.js.map +1 -1
- package/dist/esm/metrics/quickpulse/export/sender.d.ts +1 -1
- package/dist/esm/metrics/quickpulse/export/sender.d.ts.map +1 -1
- package/dist/esm/metrics/quickpulse/export/sender.js +21 -16
- package/dist/esm/metrics/quickpulse/export/sender.js.map +1 -1
- package/dist/esm/metrics/quickpulse/liveMetrics.d.ts +5 -1
- package/dist/esm/metrics/quickpulse/liveMetrics.d.ts.map +1 -1
- package/dist/esm/metrics/quickpulse/liveMetrics.js +86 -75
- package/dist/esm/metrics/quickpulse/liveMetrics.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/traces/azureSdkInstrumentation.d.ts +12 -0
- package/dist/esm/traces/azureSdkInstrumentation.d.ts.map +1 -0
- package/dist/esm/traces/azureSdkInstrumentation.js +60 -0
- package/dist/esm/traces/azureSdkInstrumentation.js.map +1 -0
- package/dist/esm/traces/handler.d.ts +2 -13
- package/dist/esm/traces/handler.d.ts.map +1 -1
- package/dist/esm/traces/handler.js +13 -35
- package/dist/esm/traces/handler.js.map +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/azureSdkTracingBridge.d.ts +4 -4
- package/dist/esm/utils/azureSdkTracingBridge.d.ts.map +1 -1
- package/dist/esm/utils/azureSdkTracingBridge.js +11 -7
- package/dist/esm/utils/azureSdkTracingBridge.js.map +1 -1
- package/dist/esm/utils/instrumentation.d.ts +8 -0
- package/dist/esm/utils/instrumentation.d.ts.map +1 -0
- package/dist/esm/utils/instrumentation.js +23 -0
- package/dist/esm/utils/instrumentation.js.map +1 -0
- package/package.json +8 -5
|
@@ -55,6 +55,8 @@ class LiveMetrics {
|
|
|
55
55
|
quickpulseExporter;
|
|
56
56
|
pingSender;
|
|
57
57
|
isCollectingData;
|
|
58
|
+
isShutdown = false;
|
|
59
|
+
resetCountersOnActivation = true;
|
|
58
60
|
isDeactivating = false;
|
|
59
61
|
deactivatingPromise;
|
|
60
62
|
lastSuccessTime = Date.now();
|
|
@@ -146,23 +148,28 @@ class LiveMetrics {
|
|
|
146
148
|
this.isCollectingData = false;
|
|
147
149
|
this.pingInterval = PING_INTERVAL; // Default
|
|
148
150
|
this.postInterval = POST_INTERVAL;
|
|
149
|
-
|
|
150
|
-
this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);
|
|
151
|
-
this.handle.unref(); // Don't block apps from terminating
|
|
151
|
+
this.schedulePing();
|
|
152
152
|
this.lastCpuUsage = process.cpuUsage();
|
|
153
153
|
this.lastHrTime = process.hrtime.bigint();
|
|
154
154
|
}
|
|
155
155
|
async shutdown() {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// reactivate fallback in quickPulseDone(). Delegate to deactivateMetrics()
|
|
159
|
-
// which manages the in-flight deactivation promise so callers (including
|
|
160
|
-
// a concurrent failure-fallback in quickPulseDone) all observe the same
|
|
161
|
-
// completion and shutdown waits for any in-flight deactivation to finish.
|
|
156
|
+
this.isShutdown = true;
|
|
157
|
+
clearTimeout(this.handle);
|
|
162
158
|
this.isCollectingData = false;
|
|
163
159
|
await this.deactivateMetrics();
|
|
164
160
|
}
|
|
161
|
+
schedulePing() {
|
|
162
|
+
clearTimeout(this.handle);
|
|
163
|
+
if (!this.isShutdown && !this.isCollectingData) {
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
165
|
+
this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);
|
|
166
|
+
this.handle.unref();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
165
169
|
async goQuickpulse() {
|
|
170
|
+
if (this.isShutdown) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
166
173
|
if (!this.isCollectingData) {
|
|
167
174
|
// If not collecting, Ping
|
|
168
175
|
try {
|
|
@@ -173,21 +180,22 @@ class LiveMetrics {
|
|
|
173
180
|
};
|
|
174
181
|
await api_1.context.with((0, core_1.suppressTracing)(api_1.context.active()), async () => {
|
|
175
182
|
const response = await this.pingSender.isSubscribed(params);
|
|
176
|
-
this.quickPulseDone(response);
|
|
183
|
+
await this.quickPulseDone(response);
|
|
177
184
|
});
|
|
178
185
|
}
|
|
179
186
|
catch (error) {
|
|
180
|
-
this.quickPulseDone(undefined);
|
|
187
|
+
await this.quickPulseDone(undefined);
|
|
181
188
|
}
|
|
182
|
-
|
|
183
|
-
this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);
|
|
184
|
-
this.handle.unref();
|
|
189
|
+
this.schedulePing();
|
|
185
190
|
}
|
|
186
191
|
if (this.isCollectingData) {
|
|
187
192
|
this.activateMetrics({ collectionInterval: this.postInterval });
|
|
188
193
|
}
|
|
189
194
|
}
|
|
190
195
|
async quickPulseDone(response) {
|
|
196
|
+
if (this.isShutdown) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
191
199
|
if (!response) {
|
|
192
200
|
if (!this.isCollectingData) {
|
|
193
201
|
if (Date.now() - this.lastSuccessTime >= MAX_PING_WAIT_TIME) {
|
|
@@ -195,55 +203,26 @@ class LiveMetrics {
|
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
else {
|
|
198
|
-
if (Date.now() - this.lastSuccessTime >= MAX_POST_WAIT_TIME
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// synchronously from inside the shutdown's export call. If a
|
|
202
|
-
// deactivation is already in flight, bail out — awaiting the
|
|
203
|
-
// in-flight promise here would deadlock the exporter's callback.
|
|
204
|
-
if (this.isDeactivating) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
206
|
+
if (Date.now() - this.lastSuccessTime >= MAX_POST_WAIT_TIME &&
|
|
207
|
+
this.postInterval !== FALLBACK_INTERVAL &&
|
|
208
|
+
!this.isDeactivating) {
|
|
207
209
|
this.postInterval = FALLBACK_INTERVAL;
|
|
208
|
-
|
|
209
|
-
await this.deactivateMetrics();
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
// The exporter invokes postCallback without awaiting it, so a
|
|
213
|
-
// rejection here would surface as an unhandled rejection. Swallow
|
|
214
|
-
// and log so the failure path stays contained.
|
|
215
|
-
logger_js_1.Logger.getInstance().warn("Failed to deactivate Live Metrics during failure fallback", error);
|
|
216
|
-
}
|
|
217
|
-
// Reset the success-time baseline so the FALLBACK_INTERVAL backoff
|
|
218
|
-
// can take effect before we consider deactivating again.
|
|
219
|
-
this.lastSuccessTime = Date.now();
|
|
220
|
-
// Re-check after the await: shutdown() may have run concurrently and
|
|
221
|
-
// flipped isCollectingData to false. Don't restart collection in
|
|
222
|
-
// that case — doing so would re-create the meterProvider after
|
|
223
|
-
// shutdown has begun.
|
|
224
|
-
if (this.isCollectingData) {
|
|
225
|
-
this.activateMetrics({ collectionInterval: this.postInterval });
|
|
226
|
-
}
|
|
210
|
+
await this.restartMetrics();
|
|
227
211
|
}
|
|
228
212
|
}
|
|
229
213
|
}
|
|
230
214
|
else {
|
|
215
|
+
const wasBackingOff = this.postInterval !== POST_INTERVAL;
|
|
231
216
|
this.postInterval = POST_INTERVAL;
|
|
232
217
|
// Update using response if needed
|
|
233
218
|
this.lastSuccessTime = Date.now();
|
|
234
219
|
this.isCollectingData =
|
|
235
220
|
response.xMsQpsSubscribed && response.xMsQpsSubscribed === "true" ? true : false;
|
|
236
|
-
if (response.
|
|
221
|
+
if (response.eTag !== undefined &&
|
|
222
|
+
response.xMsQpsConfigurationEtag &&
|
|
223
|
+
this.etag !== response.xMsQpsConfigurationEtag) {
|
|
237
224
|
this.updateConfiguration(response);
|
|
238
225
|
}
|
|
239
|
-
// If collecting was stoped
|
|
240
|
-
if (!this.isCollectingData && this.meterProvider) {
|
|
241
|
-
this.etag = "";
|
|
242
|
-
await this.deactivateMetrics();
|
|
243
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
244
|
-
this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);
|
|
245
|
-
this.handle.unref();
|
|
246
|
-
}
|
|
247
226
|
const endpointRedirect = response.xMsQpsServiceEndpointRedirectV2;
|
|
248
227
|
if (endpointRedirect) {
|
|
249
228
|
this.pingSender.handlePermanentRedirect(endpointRedirect);
|
|
@@ -256,11 +235,35 @@ class LiveMetrics {
|
|
|
256
235
|
else {
|
|
257
236
|
this.pingInterval = PING_INTERVAL;
|
|
258
237
|
}
|
|
238
|
+
if (!this.isCollectingData && (this.meterProvider || this.isDeactivating)) {
|
|
239
|
+
this.etag = "";
|
|
240
|
+
this.quickpulseExporter.setEtag("");
|
|
241
|
+
await this.restartMetrics(false);
|
|
242
|
+
}
|
|
243
|
+
else if (this.isCollectingData && wasBackingOff && !this.isDeactivating) {
|
|
244
|
+
await this.restartMetrics();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async restartMetrics(preserveConfiguration = true) {
|
|
249
|
+
// A reader's interval is fixed at construction. Preserve collection state when
|
|
250
|
+
// replacing it, and let the shutdown flush update the desired interval.
|
|
251
|
+
try {
|
|
252
|
+
await this.deactivateMetrics(preserveConfiguration);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
logger_js_1.Logger.getInstance().warn("Failed to restart Live Metrics collection", error);
|
|
256
|
+
}
|
|
257
|
+
if (this.isCollectingData) {
|
|
258
|
+
this.activateMetrics({ collectionInterval: this.postInterval });
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
this.schedulePing();
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
264
|
// Activate live metrics collection
|
|
262
265
|
activateMetrics(options) {
|
|
263
|
-
if (this.meterProvider) {
|
|
266
|
+
if (this.meterProvider || this.isDeactivating || this.isShutdown) {
|
|
264
267
|
return;
|
|
265
268
|
}
|
|
266
269
|
// Turn on live metrics active collection for statsbeat
|
|
@@ -268,20 +271,25 @@ class LiveMetrics {
|
|
|
268
271
|
(0, statsbeat_js_1.getInstance)().setStatsbeatFeatures({}, { liveMetrics: true });
|
|
269
272
|
this.statsbeatOptionsUpdated = true;
|
|
270
273
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
274
|
+
// Reader replacement must retain both totals and sampling baselines so
|
|
275
|
+
// telemetry recorded during the final flush is collected exactly once.
|
|
276
|
+
if (this.resetCountersOnActivation) {
|
|
277
|
+
this.totalDependencyCount = 0;
|
|
278
|
+
this.totalExceptionCount = 0;
|
|
279
|
+
this.totalFailedDependencyCount = 0;
|
|
280
|
+
this.totalFailedRequestCount = 0;
|
|
281
|
+
this.totalRequestCount = 0;
|
|
282
|
+
this.requestDuration = 0;
|
|
283
|
+
this.dependencyDuration = 0;
|
|
284
|
+
this.lastRequestDuration = { count: 0, duration: 0, time: 0 };
|
|
285
|
+
this.lastRequestRate = { count: 0, time: 0 };
|
|
286
|
+
this.lastFailedRequestRate = { count: 0, time: 0 };
|
|
287
|
+
this.lastDependencyDuration = { count: 0, duration: 0, time: 0 };
|
|
288
|
+
this.lastDependencyRate = { count: 0, time: 0 };
|
|
289
|
+
this.lastFailedDependencyRate = { count: 0, time: 0 };
|
|
290
|
+
this.lastExceptionRate = { count: 0, time: 0 };
|
|
291
|
+
this.resetCountersOnActivation = false;
|
|
292
|
+
}
|
|
285
293
|
const metricReaderOptions = {
|
|
286
294
|
exporter: this.quickpulseExporter,
|
|
287
295
|
exportIntervalMillis: options?.collectionInterval,
|
|
@@ -333,7 +341,17 @@ class LiveMetrics {
|
|
|
333
341
|
/**
|
|
334
342
|
* Deactivate metric collection
|
|
335
343
|
*/
|
|
336
|
-
async deactivateMetrics() {
|
|
344
|
+
async deactivateMetrics(preserveConfiguration = false) {
|
|
345
|
+
if (!preserveConfiguration) {
|
|
346
|
+
this.resetCountersOnActivation = true;
|
|
347
|
+
this.documents = [];
|
|
348
|
+
this.validDocumentFilterConjuctionGroupInfos.clear();
|
|
349
|
+
this.errorTracker.clearRunTimeErrors();
|
|
350
|
+
this.errorTracker.clearValidationTimeErrors();
|
|
351
|
+
this.validDerivedMetrics.clear();
|
|
352
|
+
this.derivedMetricProjection.clearProjectionMaps();
|
|
353
|
+
this.seenMetricIds.clear();
|
|
354
|
+
}
|
|
337
355
|
// Coalesce concurrent deactivations: callers (shutdown(), the
|
|
338
356
|
// failure-fallback in quickPulseDone(), and the "unsubscribed" branch in
|
|
339
357
|
// goQuickpulse()) can all race. Return the in-flight promise so every
|
|
@@ -345,13 +363,6 @@ class LiveMetrics {
|
|
|
345
363
|
this.isDeactivating = true;
|
|
346
364
|
this.deactivatingPromise = (async () => {
|
|
347
365
|
try {
|
|
348
|
-
this.documents = [];
|
|
349
|
-
this.validDocumentFilterConjuctionGroupInfos.clear();
|
|
350
|
-
this.errorTracker.clearRunTimeErrors();
|
|
351
|
-
this.errorTracker.clearValidationTimeErrors();
|
|
352
|
-
this.validDerivedMetrics.clear();
|
|
353
|
-
this.derivedMetricProjection.clearProjectionMaps();
|
|
354
|
-
this.seenMetricIds.clear();
|
|
355
366
|
// Capture and clear the reference before awaiting shutdown so any
|
|
356
367
|
// re-entrant calls triggered by the shutdown's final force-flush
|
|
357
368
|
// export observe meterProvider as undefined and exit early.
|
|
@@ -689,7 +700,7 @@ class LiveMetrics {
|
|
|
689
700
|
}
|
|
690
701
|
}
|
|
691
702
|
parseMetricFilterConfiguration(response) {
|
|
692
|
-
if (!response
|
|
703
|
+
if (!response.metrics || typeof response.metrics.forEach !== "function") {
|
|
693
704
|
return;
|
|
694
705
|
}
|
|
695
706
|
response.metrics.forEach((derivedMetricInfo) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveMetrics.js","sourceRoot":"","sources":["../../../../src/metrics/quickpulse/liveMetrics.ts"],"names":[],"mappings":";;;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,8DAAyB;AAKzB,4DAA0F;AAI1F,4CAAkF;AAElF,kEAAkE;AAclE,yCAWoB;AACpB,sDAAgE;AAChE,kDAAsD;AACtD,qFAA+E;AAC/E,6CAA8D;AAC9D,6DAA0E;AAS1E,yCAAgE;AAChE,8CAA4E;AAC5E,2DAAuD;AAEvD,qDAA+C;AAC/C,2DAAqD;AACrD,+GAAyG;AACzG,6DAAuD;AACvD,yEAKyC;AACzC,8EAA8E;AAC9E,0CAA4E;AAC5E,0CAAiE;AACjE,8DAAwD;AAExD,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC;;;GAGG;AACH,MAAa,WAAW;IACd,MAAM,CAAiB;IACvB,aAAa,CAA4B;IACzC,YAAY,CAA4C;IACxD,KAAK,CAAoB;IACzB,oBAAoB,CAA8B;IAClD,uBAAuB,CAA8B;IACrD,gBAAgB,CAA8B;IAC9C,sBAAsB,CAA8B;IACpD,mBAAmB,CAA8B;IACjD,yBAAyB,CAA8B;IACvD,yBAAyB,CAA8B;IACvD,mCAAmC,CAA8B;IACjE,mBAAmB,CAA8B;IAEjD,SAAS,GAAsB,EAAE,CAAC;IAClC,YAAY,CAAS;IACrB,YAAY,CAAS;IACrB,kBAAkB,CAA2B;IAC7C,UAAU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YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzzBD,kCAyzBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport os from \"node:os\";\nimport type {\n MeterProviderOptions,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { MeterProvider, PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\";\nimport type { SdkLogRecord } from \"@opentelemetry/sdk-logs\";\nimport type { InternalConfig } from \"../../shared/config.js\";\nimport type { Meter, ObservableGauge, ObservableResult } from \"@opentelemetry/api\";\nimport { SpanKind, SpanStatusCode, ValueType, context } from \"@opentelemetry/api\";\nimport type { ReadableSpan, TimedEvent } from \"@opentelemetry/sdk-trace-base\";\nimport { RandomIdGenerator } from \"@opentelemetry/sdk-trace-base\";\nimport type {\n DocumentIngress,\n Exception,\n MonitoringDataPoint,\n IsSubscribedOptionalParams,\n RemoteDependency,\n Request,\n Trace,\n KeyValuePairStringString,\n DerivedMetricInfo,\n FilterConjunctionGroupInfo,\n} from \"../../generated/index.js\";\nimport type { QuickpulseResponse } from \"./export/sender.js\";\nimport {\n getLogDocument,\n getSdkVersion,\n getSpanData,\n getLogData,\n getSpanDocument,\n getTransmissionTime,\n isRequestData,\n getSpanExceptionColumns,\n isExceptionData,\n isDependencyData,\n} from \"./utils.js\";\nimport { QuickpulseMetricExporter } from \"./export/exporter.js\";\nimport { QuickpulseSender } from \"./export/sender.js\";\nimport { ConnectionStringParser } from \"../../utils/connectionStringParser.js\";\nimport { DEFAULT_LIVEMETRICS_ENDPOINT } from \"../../types.js\";\nimport { getAuthenticationCredentialFromEnv } from \"./credentialUtils.js\";\nimport type {\n QuickpulseExporterOptions,\n RequestData,\n DependencyData,\n TraceData,\n ExceptionData,\n TelemetryData,\n} from \"./types.js\";\nimport { QuickPulseOpenTelemetryMetricNames } from \"./types.js\";\nimport { hrTimeToMilliseconds, suppressTracing } from \"@opentelemetry/core\";\nimport { getInstance } from \"../../utils/statsbeat.js\";\nimport type { CollectionConfigurationError } from \"../../generated/index.js\";\nimport { Filter } from \"./filtering/filter.js\";\nimport { Validator } from \"./filtering/validator.js\";\nimport { CollectionConfigurationErrorTracker } from \"./filtering/collectionConfigurationErrorTracker.js\";\nimport { Projection } from \"./filtering/projection.js\";\nimport {\n TelemetryTypeError,\n UnexpectedFilterCreateError,\n DuplicateMetricIdError,\n MetricFailureToCreateError,\n} from \"./filtering/quickpulseErrors.js\";\nimport { SEMATTRS_EXCEPTION_TYPE } from \"@opentelemetry/semantic-conventions\";\nimport { getPhysicalMemory, getProcessorTimeNormalized } from \"../utils.js\";\nimport { getCloudRole, getCloudRoleInstance } from \"../utils.js\";\nimport { Logger } from \"../../shared/logging/logger.js\";\n\nconst POST_INTERVAL = 1000;\nconst MAX_POST_WAIT_TIME = 20000;\nconst PING_INTERVAL = 5000;\nconst MAX_PING_WAIT_TIME = 60000;\nconst FALLBACK_INTERVAL = 60000;\n\n/**\n * Azure Monitor Live Metrics\n * @internal\n */\nexport class LiveMetrics {\n private config: InternalConfig;\n private meterProvider: MeterProvider | undefined;\n private metricReader: PeriodicExportingMetricReader | undefined;\n private meter: Meter | undefined;\n private requestDurationGauge: ObservableGauge | undefined;\n private dependencyDurationGauge: ObservableGauge | undefined;\n private requestRateGauge: ObservableGauge | undefined;\n private requestFailedRateGauge: ObservableGauge | undefined;\n private dependencyRateGauge: ObservableGauge | undefined;\n private dependencyFailedRateGauge: ObservableGauge | undefined;\n private processPhysicalBytesGauge: ObservableGauge | undefined;\n private percentProcessorTimeNormalizedGauge: ObservableGauge | undefined;\n private exceptionsRateGauge: ObservableGauge | undefined;\n\n private documents: DocumentIngress[] = [];\n private pingInterval: number;\n private postInterval: number;\n private quickpulseExporter: QuickpulseMetricExporter;\n private pingSender: QuickpulseSender;\n private isCollectingData: boolean;\n private isDeactivating: boolean = false;\n private deactivatingPromise: Promise<void> | undefined;\n private lastSuccessTime: number = Date.now();\n private handle: NodeJS.Timer;\n // Monitoring data point with common properties\n private baseMonitoringDataPoint: MonitoringDataPoint;\n private totalRequestCount = 0;\n private totalFailedRequestCount = 0;\n private totalDependencyCount = 0;\n private totalFailedDependencyCount = 0;\n private totalExceptionCount = 0;\n private requestDuration = 0;\n private dependencyDuration = 0;\n private lastRequestDuration: { count: number; duration: number; time: number } = {\n count: 0,\n duration: 0,\n time: 0,\n };\n private lastRequestRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastFailedRequestRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastDependencyDuration: { count: number; duration: number; time: number } = {\n count: 0,\n duration: 0,\n time: 0,\n };\n private lastDependencyRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastFailedDependencyRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastExceptionRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastCpuUsage: NodeJS.CpuUsage;\n private lastHrTime: bigint;\n private statsbeatOptionsUpdated = false;\n private etag: string = \"\";\n private errorTracker: CollectionConfigurationErrorTracker =\n new CollectionConfigurationErrorTracker();\n // For tracking of duplicate metric ids in the same configuration.\n private seenMetricIds: Set<string> = new Set();\n private validDerivedMetrics: Map<string, DerivedMetricInfo[]> = new Map();\n private derivedMetricProjection: Projection = new Projection();\n private validator: Validator = new Validator();\n private filter: Filter = new Filter();\n // type: Map<telemetryType, Map<id, FilterConjunctionGroupInfo[]>>\n private validDocumentFilterConjuctionGroupInfos: Map<\n string,\n Map<string, FilterConjunctionGroupInfo[]>\n > = new Map();\n /**\n * Initializes a new instance of the StandardMetrics class.\n * @param config - Distro configuration.\n * @param options - Standard Metrics options.\n */\n constructor(config: InternalConfig) {\n this.config = config;\n const idGenerator = new RandomIdGenerator();\n const streamId = idGenerator.generateTraceId();\n const machineName = os.hostname();\n const instance = getCloudRoleInstance(this.config.resource);\n const roleName = getCloudRole(this.config.resource);\n const version = getSdkVersion();\n this.baseMonitoringDataPoint = {\n version: version,\n invariantVersion: 5, // 5 means we support live metrics filtering of metrics and documents\n instance: instance,\n roleName: roleName,\n machineName: machineName,\n streamId: streamId,\n performanceCollectionSupported: true,\n isWebApp: process.env[\"WEBSITE_SITE_NAME\"] ? true : false,\n };\n const parsedConnectionString = ConnectionStringParser.parse(\n this.config.azureMonitorExporterOptions.connectionString ||\n process.env[\"APPLICATIONINSIGHTS_CONNECTION_STRING\"],\n );\n const credential =\n this.config.azureMonitorExporterOptions.credential ?? getAuthenticationCredentialFromEnv();\n this.pingSender = new QuickpulseSender({\n endpointUrl: parsedConnectionString.liveendpoint || DEFAULT_LIVEMETRICS_ENDPOINT,\n instrumentationKey: parsedConnectionString.instrumentationkey || \"\",\n credential: credential,\n credentialScopes:\n parsedConnectionString.aadaudience ||\n this.config.azureMonitorExporterOptions.credentialScopes,\n });\n const exporterOptions: QuickpulseExporterOptions = {\n endpointUrl: parsedConnectionString.liveendpoint || DEFAULT_LIVEMETRICS_ENDPOINT,\n instrumentationKey: parsedConnectionString.instrumentationkey || \"\",\n credential: credential,\n credentialScopes:\n parsedConnectionString.aadaudience ||\n this.config.azureMonitorExporterOptions.credentialScopes,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n postCallback: this.quickPulseDone.bind(this),\n getDocumentsFn: this.getDocuments.bind(this),\n getErrorsFn: this.getErrors.bind(this),\n getDerivedMetricValuesFn: this.getDerivedMetricValues.bind(this),\n baseMonitoringDataPoint: this.baseMonitoringDataPoint,\n };\n this.quickpulseExporter = new QuickpulseMetricExporter(exporterOptions);\n this.isCollectingData = false;\n this.pingInterval = PING_INTERVAL; // Default\n this.postInterval = POST_INTERVAL;\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);\n this.handle.unref(); // Don't block apps from terminating\n this.lastCpuUsage = process.cpuUsage();\n this.lastHrTime = process.hrtime.bigint();\n }\n\n public async shutdown(): Promise<void> {\n // Force collecting=false before tearing down so the shutdown's final\n // force-flush export, if it fails, cannot trigger the deactivate/\n // reactivate fallback in quickPulseDone(). Delegate to deactivateMetrics()\n // which manages the in-flight deactivation promise so callers (including\n // a concurrent failure-fallback in quickPulseDone) all observe the same\n // completion and shutdown waits for any in-flight deactivation to finish.\n this.isCollectingData = false;\n await this.deactivateMetrics();\n }\n\n private async goQuickpulse(): Promise<void> {\n if (!this.isCollectingData) {\n // If not collecting, Ping\n try {\n const params: IsSubscribedOptionalParams = {\n transmissionTime: getTransmissionTime(),\n monitoringDataPoint: this.baseMonitoringDataPoint,\n configurationEtag: this.etag,\n };\n await context.with(suppressTracing(context.active()), async () => {\n const response = await this.pingSender.isSubscribed(params);\n this.quickPulseDone(response);\n });\n } catch (error) {\n this.quickPulseDone(undefined);\n }\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);\n this.handle.unref();\n }\n if (this.isCollectingData) {\n this.activateMetrics({ collectionInterval: this.postInterval });\n }\n }\n\n private async quickPulseDone(response: QuickpulseResponse | undefined): Promise<void> {\n if (!response) {\n if (!this.isCollectingData) {\n if (Date.now() - this.lastSuccessTime >= MAX_PING_WAIT_TIME) {\n this.pingInterval = FALLBACK_INTERVAL;\n }\n } else {\n if (Date.now() - this.lastSuccessTime >= MAX_POST_WAIT_TIME) {\n // Re-entrancy guard: MeterProvider.shutdown() triggers a final\n // force-flush export which, on failure, re-invokes this callback\n // synchronously from inside the shutdown's export call. If a\n // deactivation is already in flight, bail out — awaiting the\n // in-flight promise here would deadlock the exporter's callback.\n if (this.isDeactivating) {\n return;\n }\n this.postInterval = FALLBACK_INTERVAL;\n try {\n await this.deactivateMetrics();\n } catch (error) {\n // The exporter invokes postCallback without awaiting it, so a\n // rejection here would surface as an unhandled rejection. Swallow\n // and log so the failure path stays contained.\n Logger.getInstance().warn(\n \"Failed to deactivate Live Metrics during failure fallback\",\n error,\n );\n }\n // Reset the success-time baseline so the FALLBACK_INTERVAL backoff\n // can take effect before we consider deactivating again.\n this.lastSuccessTime = Date.now();\n // Re-check after the await: shutdown() may have run concurrently and\n // flipped isCollectingData to false. Don't restart collection in\n // that case — doing so would re-create the meterProvider after\n // shutdown has begun.\n if (this.isCollectingData) {\n this.activateMetrics({ collectionInterval: this.postInterval });\n }\n }\n }\n } else {\n this.postInterval = POST_INTERVAL;\n // Update using response if needed\n this.lastSuccessTime = Date.now();\n this.isCollectingData =\n response.xMsQpsSubscribed && response.xMsQpsSubscribed === \"true\" ? true : false;\n if (response.xMsQpsConfigurationEtag && this.etag !== response.xMsQpsConfigurationEtag) {\n this.updateConfiguration(response);\n }\n\n // If collecting was stoped\n if (!this.isCollectingData && this.meterProvider) {\n this.etag = \"\";\n await this.deactivateMetrics();\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);\n this.handle.unref();\n }\n\n const endpointRedirect = response.xMsQpsServiceEndpointRedirectV2;\n if (endpointRedirect) {\n this.pingSender.handlePermanentRedirect(endpointRedirect);\n this.quickpulseExporter.getSender().handlePermanentRedirect(endpointRedirect);\n }\n const pollingInterval = response.xMsQpsServicePollingIntervalHint;\n if (pollingInterval) {\n this.pingInterval = Number(pollingInterval);\n } else {\n this.pingInterval = PING_INTERVAL;\n }\n }\n }\n\n // Activate live metrics collection\n public activateMetrics(options?: { collectionInterval: number }): void {\n if (this.meterProvider) {\n return;\n }\n // Turn on live metrics active collection for statsbeat\n if (!this.statsbeatOptionsUpdated) {\n getInstance().setStatsbeatFeatures({}, { liveMetrics: true });\n this.statsbeatOptionsUpdated = true;\n }\n this.totalDependencyCount = 0;\n this.totalExceptionCount = 0;\n this.totalFailedDependencyCount = 0;\n this.totalFailedRequestCount = 0;\n this.totalRequestCount = 0;\n this.requestDuration = 0;\n this.dependencyDuration = 0;\n this.lastRequestDuration = { count: 0, duration: 0, time: 0 };\n this.lastRequestRate = { count: 0, time: 0 };\n this.lastFailedRequestRate = { count: 0, time: 0 };\n this.lastDependencyDuration = { count: 0, duration: 0, time: 0 };\n this.lastDependencyRate = { count: 0, time: 0 };\n this.lastFailedDependencyRate = { count: 0, time: 0 };\n this.lastExceptionRate = { count: 0, time: 0 };\n\n const metricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.quickpulseExporter,\n exportIntervalMillis: options?.collectionInterval,\n };\n this.metricReader = new PeriodicExportingMetricReader(metricReaderOptions);\n const meterProviderConfig: MeterProviderOptions = {\n resource: this.config.resource,\n readers: [this.metricReader],\n };\n this.meterProvider = new MeterProvider(meterProviderConfig);\n this.meter = this.meterProvider.getMeter(\"AzureMonitorLiveMetricsMeter\");\n this.requestDurationGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_DURATION,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.requestRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.requestFailedRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_FAILURE_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyDurationGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_DURATION,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyFailedRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_FAILURE_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n\n this.processPhysicalBytesGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.PHYSICAL_BYTES,\n {\n valueType: ValueType.INT,\n },\n );\n\n this.percentProcessorTimeNormalizedGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.PROCESSOR_TIME_NORMALIZED,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.exceptionsRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.EXCEPTION_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n\n this.requestDurationGauge.addCallback(this.getRequestDuration.bind(this));\n this.requestRateGauge.addCallback(this.getRequestRate.bind(this));\n this.requestFailedRateGauge.addCallback(this.getRequestFailedRate.bind(this));\n this.dependencyDurationGauge.addCallback(this.getDependencyDuration.bind(this));\n this.dependencyRateGauge.addCallback(this.getDependencyRate.bind(this));\n this.dependencyFailedRateGauge.addCallback(this.getDependencyFailedRate.bind(this));\n this.exceptionsRateGauge.addCallback(this.getExceptionRate.bind(this));\n this.processPhysicalBytesGauge.addCallback(this.getPhysicalMemory.bind(this));\n this.percentProcessorTimeNormalizedGauge.addCallback(\n this.getProcessorTimeNormalized.bind(this),\n );\n }\n\n /**\n * Deactivate metric collection\n */\n public async deactivateMetrics(): Promise<void> {\n // Coalesce concurrent deactivations: callers (shutdown(), the\n // failure-fallback in quickPulseDone(), and the \"unsubscribed\" branch in\n // goQuickpulse()) can all race. Return the in-flight promise so every\n // caller awaits the same completion and the underlying meterProvider\n // shutdown only runs once.\n if (this.deactivatingPromise) {\n return this.deactivatingPromise;\n }\n this.isDeactivating = true;\n this.deactivatingPromise = (async () => {\n try {\n this.documents = [];\n this.validDocumentFilterConjuctionGroupInfos.clear();\n this.errorTracker.clearRunTimeErrors();\n this.errorTracker.clearValidationTimeErrors();\n this.validDerivedMetrics.clear();\n this.derivedMetricProjection.clearProjectionMaps();\n this.seenMetricIds.clear();\n // Capture and clear the reference before awaiting shutdown so any\n // re-entrant calls triggered by the shutdown's final force-flush\n // export observe meterProvider as undefined and exit early.\n const provider = this.meterProvider;\n this.meterProvider = undefined;\n await provider?.shutdown();\n } finally {\n this.isDeactivating = false;\n this.deactivatingPromise = undefined;\n }\n })();\n return this.deactivatingPromise;\n }\n\n /**\n * Force flush Meter Provider.\n */\n public async flush(): Promise<void> {\n await this.meterProvider?.forceFlush();\n }\n\n /**\n *Get OpenTelemetry MeterProvider\n */\n public getMeterProvider(): MeterProvider | undefined {\n return this.meterProvider;\n }\n\n public getDocuments(): DocumentIngress[] {\n const result: DocumentIngress[] = this.documents;\n this.documents = [];\n return result;\n }\n\n public getErrors(): CollectionConfigurationError[] {\n const result = this.errorTracker.getErrors();\n this.errorTracker.clearRunTimeErrors();\n return result;\n }\n\n public getDerivedMetricValues(): Map<string, number> {\n return this.derivedMetricProjection.getMetricValues();\n }\n\n private addDocument(document: DocumentIngress): void {\n if (document) {\n // Limit risk of memory leak by limiting doc length to something manageable\n if (this.documents.length > 20) {\n this.documents.shift(); // Remove oldest document\n }\n this.documents.push(document);\n }\n }\n\n /**\n * Record Span metrics\n * @internal\n */\n public recordSpan(span: ReadableSpan): void {\n if (this.isCollectingData) {\n const columns: RequestData | DependencyData = getSpanData(span);\n let documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>;\n let derivedMetricInfos: DerivedMetricInfo[];\n if (isRequestData(columns)) {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Request\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n derivedMetricInfos = this.validDerivedMetrics.get(\"Request\") || [];\n } else {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Dependency\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n derivedMetricInfos = this.validDerivedMetrics.get(\"Dependency\") || [];\n }\n this.applyDocumentFilters(documentConfiguration, columns);\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, columns);\n\n const durationMs = hrTimeToMilliseconds(span.duration);\n const success = span.status.code !== SpanStatusCode.ERROR;\n\n if (span.kind === SpanKind.SERVER || span.kind === SpanKind.CONSUMER) {\n this.totalRequestCount++;\n this.requestDuration += durationMs;\n if (!success) {\n this.totalFailedRequestCount++;\n }\n } else {\n this.totalDependencyCount++;\n this.dependencyDuration += durationMs;\n if (!success) {\n this.totalFailedDependencyCount++;\n }\n }\n if (span.events) {\n span.events.forEach((event: TimedEvent) => {\n event.attributes = event.attributes || {};\n if (event.name === \"exception\") {\n const exceptionColumns: ExceptionData = getSpanExceptionColumns(\n event.attributes,\n span.attributes,\n );\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Exception\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(\n documentConfiguration,\n exceptionColumns,\n event.attributes[SEMATTRS_EXCEPTION_TYPE] as string,\n );\n derivedMetricInfos = this.validDerivedMetrics.get(\"Exception\") || [];\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, exceptionColumns);\n this.totalExceptionCount++;\n }\n });\n }\n }\n }\n\n /**\n * Record LogRecord metrics, add attribute so data is not aggregated again in ingestion\n * @internal\n */\n public recordLog(logRecord: SdkLogRecord): void {\n if (this.isCollectingData) {\n const columns: TraceData | ExceptionData = getLogData(logRecord);\n let derivedMetricInfos: DerivedMetricInfo[];\n let documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>;\n if (isExceptionData(columns)) {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Exception\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(\n documentConfiguration,\n columns,\n logRecord.attributes[SEMATTRS_EXCEPTION_TYPE] as string,\n );\n derivedMetricInfos = this.validDerivedMetrics.get(\"Exception\") || [];\n this.totalExceptionCount++;\n } else {\n // trace\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Trace\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(documentConfiguration, columns);\n derivedMetricInfos = this.validDerivedMetrics.get(\"Trace\") || [];\n }\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, columns);\n }\n }\n\n private getRequestDuration(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const requestInterval = this.totalRequestCount - this.lastRequestDuration.count || 0;\n const durationInterval = this.requestDuration - this.lastRequestDuration.duration || 0;\n const elapsedMs = currentTime - this.lastRequestDuration.time;\n if (elapsedMs > 0) {\n const averageExecutionTime = durationInterval / requestInterval || 0; // default to 0 in case no requests in this interval\n observableResult.observe(averageExecutionTime);\n }\n this.lastRequestDuration = {\n count: this.totalRequestCount,\n duration: this.requestDuration,\n time: currentTime,\n };\n }\n\n private getRequestRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalRequestCount - this.lastRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastRequestRate = {\n count: this.totalRequestCount,\n time: currentTime,\n };\n }\n\n private getRequestFailedRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalFailedRequestCount - this.lastFailedRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastFailedRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastFailedRequestRate = {\n count: this.totalFailedRequestCount,\n time: currentTime,\n };\n }\n\n private getDependencyDuration(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const dependencyInterval = this.totalDependencyCount - this.lastDependencyDuration.count || 0;\n const durationInterval = this.dependencyDuration - this.lastDependencyDuration.duration || 0;\n const elapsedMs = currentTime - this.lastDependencyDuration.time;\n if (elapsedMs > 0) {\n const averageExecutionTime = durationInterval / dependencyInterval || 0; // default to 0 in case no dependencies in this interval\n observableResult.observe(averageExecutionTime);\n }\n this.lastDependencyDuration = {\n count: this.totalDependencyCount,\n duration: this.dependencyDuration,\n time: currentTime,\n };\n }\n\n private getDependencyRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalDependencyCount - this.lastDependencyRate.count || 0;\n const elapsedMs = currentTime - this.lastDependencyRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastDependencyRate = {\n count: this.totalDependencyCount,\n time: currentTime,\n };\n }\n\n private getDependencyFailedRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalFailedDependencyCount - this.lastFailedDependencyRate.count || 0;\n const elapsedMs = currentTime - this.lastFailedDependencyRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastFailedDependencyRate = {\n count: this.totalFailedDependencyCount,\n time: currentTime,\n };\n }\n\n private getExceptionRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalExceptionCount - this.lastExceptionRate.count || 0;\n const elapsedMs = currentTime - this.lastExceptionRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastExceptionRate = {\n count: this.totalExceptionCount,\n time: currentTime,\n };\n }\n\n private getPhysicalMemory(observableResult: ObservableResult): void {\n const rss = getPhysicalMemory();\n observableResult.observe(rss);\n }\n\n private getProcessorTimeNormalized(observableResult: ObservableResult): void {\n if (process && process.hrtime) {\n const cpuUsagePercent = getProcessorTimeNormalized(this.lastHrTime, this.lastCpuUsage);\n observableResult.observe(cpuUsagePercent);\n this.lastHrTime = process.hrtime.bigint();\n this.lastCpuUsage = process.cpuUsage();\n } else {\n Logger.getInstance().debug(\"Getting Normalized Processor Time Failed. No process available.\");\n }\n }\n\n private updateConfiguration(response: QuickpulseResponse): void {\n this.etag = response.xMsQpsConfigurationEtag || \"\";\n this.quickpulseExporter.setEtag(this.etag);\n this.errorTracker.clearValidationTimeErrors();\n this.validDocumentFilterConjuctionGroupInfos.clear();\n this.validDerivedMetrics.clear();\n this.derivedMetricProjection.clearProjectionMaps();\n this.seenMetricIds.clear();\n\n this.parseDocumentFilterConfiguration(response);\n this.parseMetricFilterConfiguration(response);\n }\n\n private parseDocumentFilterConfiguration(response: QuickpulseResponse): void {\n if (!response?.documentStreams || typeof response.documentStreams.forEach !== \"function\") {\n return;\n }\n response.documentStreams.forEach((documentStreamInfo) => {\n documentStreamInfo.documentFilterGroups.forEach((documentFilterGroupInfo) => {\n try {\n this.validator.validateTelemetryType(documentFilterGroupInfo.telemetryType);\n this.validator.validateDocumentFilters(documentFilterGroupInfo);\n this.filter.renameExceptionFieldNamesForFiltering(documentFilterGroupInfo.filters);\n\n if (\n !this.validDocumentFilterConjuctionGroupInfos.has(documentFilterGroupInfo.telemetryType)\n ) {\n this.validDocumentFilterConjuctionGroupInfos.set(\n documentFilterGroupInfo.telemetryType,\n new Map<string, FilterConjunctionGroupInfo[]>(),\n );\n }\n\n const innerMap = this.validDocumentFilterConjuctionGroupInfos.get(\n documentFilterGroupInfo.telemetryType,\n );\n if (!innerMap?.has(documentStreamInfo.id)) {\n innerMap?.set(documentStreamInfo.id, [documentFilterGroupInfo.filters]);\n } else {\n innerMap.get(documentStreamInfo.id)?.push(documentFilterGroupInfo.filters);\n }\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof TelemetryTypeError) {\n configError.collectionConfigurationErrorType =\n \"CollectionConfigurationFailureToCreateUnexpected\";\n } else if (error instanceof UnexpectedFilterCreateError) {\n configError.collectionConfigurationErrorType =\n \"DocumentStreamFailureToCreateFilterUnexpected\";\n }\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const data: KeyValuePairStringString[] = [];\n data.push({ key: \"DocumentStreamInfoId\", value: documentStreamInfo.id });\n data.push({ key: \"ETag\", value: this.etag });\n configError.data = data;\n this.errorTracker.addValidationError(configError);\n }\n });\n });\n }\n\n private applyDocumentFilters(\n documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>,\n data: TelemetryData,\n exceptionType?: string,\n ): void {\n const streamIds: Set<string> = new Set<string>();\n documentConfiguration.forEach((filterConjunctionGroupInfoList, streamId) => {\n filterConjunctionGroupInfoList.forEach((filterConjunctionGroupInfo) => {\n // by going though each filterConjuctionGroupInfo, we are implicitly -OR-ing\n // different filterConjunctionGroupInfo within documentStreamInfo. If there are multiple\n // documentStreamInfos, this logic will -OR- the filtering results of each documentStreamInfo.\n if (this.filter.checkFilterConjunctionGroup(filterConjunctionGroupInfo, data)) {\n streamIds.add(streamId);\n }\n });\n });\n\n // Emit a document when a telemetry data matches a particular filtering configuration,\n // or when filtering configuration is empty.\n if (streamIds.size > 0 || documentConfiguration.size === 0) {\n let document: Request | RemoteDependency | Trace | Exception;\n if (isRequestData(data) || isDependencyData(data)) {\n document = getSpanDocument(data);\n } else if (isExceptionData(data) && exceptionType) {\n document = getLogDocument(data, exceptionType);\n } else {\n document = getLogDocument(data);\n }\n document.documentStreamIds = [...streamIds];\n this.addDocument(document);\n }\n }\n\n private parseMetricFilterConfiguration(response: QuickpulseResponse): void {\n if (!response?.documentStreams || typeof response.documentStreams.forEach !== \"function\") {\n return;\n }\n response.metrics.forEach((derivedMetricInfo) => {\n try {\n if (!this.seenMetricIds.has(derivedMetricInfo.id)) {\n this.seenMetricIds.add(derivedMetricInfo.id);\n this.validator.validateTelemetryType(derivedMetricInfo.telemetryType);\n this.validator.checkCustomMetricProjection(derivedMetricInfo);\n this.validator.validateMetricFilters(derivedMetricInfo);\n derivedMetricInfo.filterGroups.forEach((filterConjunctionGroupInfo) => {\n this.filter.renameExceptionFieldNamesForFiltering(filterConjunctionGroupInfo);\n });\n\n if (this.validDerivedMetrics.has(derivedMetricInfo.telemetryType)) {\n this.validDerivedMetrics.get(derivedMetricInfo.telemetryType)?.push(derivedMetricInfo);\n } else {\n this.validDerivedMetrics.set(derivedMetricInfo.telemetryType, [derivedMetricInfo]);\n }\n } else {\n throw new DuplicateMetricIdError(`Duplicate Metric Id: ${derivedMetricInfo.id}`);\n }\n this.derivedMetricProjection.initDerivedMetricProjection(derivedMetricInfo);\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof TelemetryTypeError) {\n configError.collectionConfigurationErrorType = \"MetricTelemetryTypeUnsupported\";\n } else if (error instanceof UnexpectedFilterCreateError) {\n configError.collectionConfigurationErrorType = \"MetricFailureToCreateFilterUnexpected\";\n } else if (error instanceof DuplicateMetricIdError) {\n configError.collectionConfigurationErrorType = \"MetricDuplicateIds\";\n }\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const data: KeyValuePairStringString[] = [];\n data.push({ key: \"MetricId\", value: derivedMetricInfo.id });\n data.push({ key: \"ETag\", value: this.etag });\n configError.data = data;\n this.errorTracker.addValidationError(configError);\n }\n });\n }\n\n private checkMetricFilterAndCreateProjection(\n derivedMetricInfoList: DerivedMetricInfo[],\n data: TelemetryData,\n ): void {\n derivedMetricInfoList.forEach((derivedMetricInfo: DerivedMetricInfo) => {\n if (this.filter.checkMetricFilters(derivedMetricInfo, data)) {\n try {\n this.derivedMetricProjection.calculateProjection(derivedMetricInfo, data);\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof MetricFailureToCreateError) {\n configError.collectionConfigurationErrorType = \"MetricFailureToCreate\";\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const errorData: KeyValuePairStringString[] = [];\n errorData.push({ key: \"MetricId\", value: derivedMetricInfo.id });\n errorData.push({ key: \"ETag\", value: this.etag });\n configError.data = errorData;\n this.errorTracker.addRunTimeError(configError);\n }\n }\n }\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"liveMetrics.js","sourceR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GAA+B,EAAE,CAAC;wBACjD,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC;wBACjE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;wBAClD,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC;wBAC7B,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;oBACjD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAr0BD,kCAq0BC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport os from \"node:os\";\nimport type {\n MeterProviderOptions,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { MeterProvider, PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\";\nimport type { SdkLogRecord } from \"@opentelemetry/sdk-logs\";\nimport type { InternalConfig } from \"../../shared/config.js\";\nimport type { Meter, ObservableGauge, ObservableResult } from \"@opentelemetry/api\";\nimport { SpanKind, SpanStatusCode, ValueType, context } from \"@opentelemetry/api\";\nimport type { ReadableSpan, TimedEvent } from \"@opentelemetry/sdk-trace-base\";\nimport { RandomIdGenerator } from \"@opentelemetry/sdk-trace-base\";\nimport type {\n DocumentIngress,\n Exception,\n MonitoringDataPoint,\n IsSubscribedOptionalParams,\n RemoteDependency,\n Request,\n Trace,\n KeyValuePairStringString,\n DerivedMetricInfo,\n FilterConjunctionGroupInfo,\n} from \"../../generated/index.js\";\nimport type { QuickpulseResponse } from \"./export/sender.js\";\nimport {\n getLogDocument,\n getSdkVersion,\n getSpanData,\n getLogData,\n getSpanDocument,\n getTransmissionTime,\n isRequestData,\n getSpanExceptionColumns,\n isExceptionData,\n isDependencyData,\n} from \"./utils.js\";\nimport { QuickpulseMetricExporter } from \"./export/exporter.js\";\nimport { QuickpulseSender } from \"./export/sender.js\";\nimport { ConnectionStringParser } from \"../../utils/connectionStringParser.js\";\nimport { DEFAULT_LIVEMETRICS_ENDPOINT } from \"../../types.js\";\nimport { getAuthenticationCredentialFromEnv } from \"./credentialUtils.js\";\nimport type {\n QuickpulseExporterOptions,\n RequestData,\n DependencyData,\n TraceData,\n ExceptionData,\n TelemetryData,\n} from \"./types.js\";\nimport { QuickPulseOpenTelemetryMetricNames } from \"./types.js\";\nimport { hrTimeToMilliseconds, suppressTracing } from \"@opentelemetry/core\";\nimport { getInstance } from \"../../utils/statsbeat.js\";\nimport type { CollectionConfigurationError } from \"../../generated/index.js\";\nimport { Filter } from \"./filtering/filter.js\";\nimport { Validator } from \"./filtering/validator.js\";\nimport { CollectionConfigurationErrorTracker } from \"./filtering/collectionConfigurationErrorTracker.js\";\nimport { Projection } from \"./filtering/projection.js\";\nimport {\n TelemetryTypeError,\n UnexpectedFilterCreateError,\n DuplicateMetricIdError,\n MetricFailureToCreateError,\n} from \"./filtering/quickpulseErrors.js\";\nimport { SEMATTRS_EXCEPTION_TYPE } from \"@opentelemetry/semantic-conventions\";\nimport { getPhysicalMemory, getProcessorTimeNormalized } from \"../utils.js\";\nimport { getCloudRole, getCloudRoleInstance } from \"../utils.js\";\nimport { Logger } from \"../../shared/logging/logger.js\";\n\nconst POST_INTERVAL = 1000;\nconst MAX_POST_WAIT_TIME = 20000;\nconst PING_INTERVAL = 5000;\nconst MAX_PING_WAIT_TIME = 60000;\nconst FALLBACK_INTERVAL = 60000;\n\n/**\n * Azure Monitor Live Metrics\n * @internal\n */\nexport class LiveMetrics {\n private config: InternalConfig;\n private meterProvider: MeterProvider | undefined;\n private metricReader: PeriodicExportingMetricReader | undefined;\n private meter: Meter | undefined;\n private requestDurationGauge: ObservableGauge | undefined;\n private dependencyDurationGauge: ObservableGauge | undefined;\n private requestRateGauge: ObservableGauge | undefined;\n private requestFailedRateGauge: ObservableGauge | undefined;\n private dependencyRateGauge: ObservableGauge | undefined;\n private dependencyFailedRateGauge: ObservableGauge | undefined;\n private processPhysicalBytesGauge: ObservableGauge | undefined;\n private percentProcessorTimeNormalizedGauge: ObservableGauge | undefined;\n private exceptionsRateGauge: ObservableGauge | undefined;\n\n private documents: DocumentIngress[] = [];\n private pingInterval: number;\n private postInterval: number;\n private quickpulseExporter: QuickpulseMetricExporter;\n private pingSender: QuickpulseSender;\n private isCollectingData: boolean;\n private isShutdown = false;\n private resetCountersOnActivation = true;\n private isDeactivating: boolean = false;\n private deactivatingPromise: Promise<void> | undefined;\n private lastSuccessTime: number = Date.now();\n private handle: NodeJS.Timeout | undefined;\n // Monitoring data point with common properties\n private baseMonitoringDataPoint: MonitoringDataPoint;\n private totalRequestCount = 0;\n private totalFailedRequestCount = 0;\n private totalDependencyCount = 0;\n private totalFailedDependencyCount = 0;\n private totalExceptionCount = 0;\n private requestDuration = 0;\n private dependencyDuration = 0;\n private lastRequestDuration: { count: number; duration: number; time: number } = {\n count: 0,\n duration: 0,\n time: 0,\n };\n private lastRequestRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastFailedRequestRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastDependencyDuration: { count: number; duration: number; time: number } = {\n count: 0,\n duration: 0,\n time: 0,\n };\n private lastDependencyRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastFailedDependencyRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastExceptionRate: { count: number; time: number } = { count: 0, time: 0 };\n private lastCpuUsage: NodeJS.CpuUsage;\n private lastHrTime: bigint;\n private statsbeatOptionsUpdated = false;\n private etag: string = \"\";\n private errorTracker: CollectionConfigurationErrorTracker =\n new CollectionConfigurationErrorTracker();\n // For tracking of duplicate metric ids in the same configuration.\n private seenMetricIds: Set<string> = new Set();\n private validDerivedMetrics: Map<string, DerivedMetricInfo[]> = new Map();\n private derivedMetricProjection: Projection = new Projection();\n private validator: Validator = new Validator();\n private filter: Filter = new Filter();\n // type: Map<telemetryType, Map<id, FilterConjunctionGroupInfo[]>>\n private validDocumentFilterConjuctionGroupInfos: Map<\n string,\n Map<string, FilterConjunctionGroupInfo[]>\n > = new Map();\n /**\n * Initializes a new instance of the StandardMetrics class.\n * @param config - Distro configuration.\n * @param options - Standard Metrics options.\n */\n constructor(config: InternalConfig) {\n this.config = config;\n const idGenerator = new RandomIdGenerator();\n const streamId = idGenerator.generateTraceId();\n const machineName = os.hostname();\n const instance = getCloudRoleInstance(this.config.resource);\n const roleName = getCloudRole(this.config.resource);\n const version = getSdkVersion();\n this.baseMonitoringDataPoint = {\n version: version,\n invariantVersion: 5, // 5 means we support live metrics filtering of metrics and documents\n instance: instance,\n roleName: roleName,\n machineName: machineName,\n streamId: streamId,\n performanceCollectionSupported: true,\n isWebApp: process.env[\"WEBSITE_SITE_NAME\"] ? true : false,\n };\n const parsedConnectionString = ConnectionStringParser.parse(\n this.config.azureMonitorExporterOptions.connectionString ||\n process.env[\"APPLICATIONINSIGHTS_CONNECTION_STRING\"],\n );\n const credential =\n this.config.azureMonitorExporterOptions.credential ?? getAuthenticationCredentialFromEnv();\n this.pingSender = new QuickpulseSender({\n endpointUrl: parsedConnectionString.liveendpoint || DEFAULT_LIVEMETRICS_ENDPOINT,\n instrumentationKey: parsedConnectionString.instrumentationkey || \"\",\n credential: credential,\n credentialScopes:\n parsedConnectionString.aadaudience ||\n this.config.azureMonitorExporterOptions.credentialScopes,\n });\n const exporterOptions: QuickpulseExporterOptions = {\n endpointUrl: parsedConnectionString.liveendpoint || DEFAULT_LIVEMETRICS_ENDPOINT,\n instrumentationKey: parsedConnectionString.instrumentationkey || \"\",\n credential: credential,\n credentialScopes:\n parsedConnectionString.aadaudience ||\n this.config.azureMonitorExporterOptions.credentialScopes,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n postCallback: this.quickPulseDone.bind(this),\n getDocumentsFn: this.getDocuments.bind(this),\n getErrorsFn: this.getErrors.bind(this),\n getDerivedMetricValuesFn: this.getDerivedMetricValues.bind(this),\n baseMonitoringDataPoint: this.baseMonitoringDataPoint,\n };\n this.quickpulseExporter = new QuickpulseMetricExporter(exporterOptions);\n this.isCollectingData = false;\n this.pingInterval = PING_INTERVAL; // Default\n this.postInterval = POST_INTERVAL;\n this.schedulePing();\n this.lastCpuUsage = process.cpuUsage();\n this.lastHrTime = process.hrtime.bigint();\n }\n\n public async shutdown(): Promise<void> {\n this.isShutdown = true;\n clearTimeout(this.handle);\n this.isCollectingData = false;\n await this.deactivateMetrics();\n }\n\n private schedulePing(): void {\n clearTimeout(this.handle);\n if (!this.isShutdown && !this.isCollectingData) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n this.handle = setTimeout(this.goQuickpulse.bind(this), this.pingInterval);\n this.handle.unref();\n }\n }\n\n private async goQuickpulse(): Promise<void> {\n if (this.isShutdown) {\n return;\n }\n if (!this.isCollectingData) {\n // If not collecting, Ping\n try {\n const params: IsSubscribedOptionalParams = {\n transmissionTime: getTransmissionTime(),\n monitoringDataPoint: this.baseMonitoringDataPoint,\n configurationEtag: this.etag,\n };\n await context.with(suppressTracing(context.active()), async () => {\n const response = await this.pingSender.isSubscribed(params);\n await this.quickPulseDone(response);\n });\n } catch (error) {\n await this.quickPulseDone(undefined);\n }\n this.schedulePing();\n }\n if (this.isCollectingData) {\n this.activateMetrics({ collectionInterval: this.postInterval });\n }\n }\n\n private async quickPulseDone(response: QuickpulseResponse | undefined): Promise<void> {\n if (this.isShutdown) {\n return;\n }\n if (!response) {\n if (!this.isCollectingData) {\n if (Date.now() - this.lastSuccessTime >= MAX_PING_WAIT_TIME) {\n this.pingInterval = FALLBACK_INTERVAL;\n }\n } else {\n if (\n Date.now() - this.lastSuccessTime >= MAX_POST_WAIT_TIME &&\n this.postInterval !== FALLBACK_INTERVAL &&\n !this.isDeactivating\n ) {\n this.postInterval = FALLBACK_INTERVAL;\n await this.restartMetrics();\n }\n }\n } else {\n const wasBackingOff = this.postInterval !== POST_INTERVAL;\n this.postInterval = POST_INTERVAL;\n // Update using response if needed\n this.lastSuccessTime = Date.now();\n this.isCollectingData =\n response.xMsQpsSubscribed && response.xMsQpsSubscribed === \"true\" ? true : false;\n if (\n response.eTag !== undefined &&\n response.xMsQpsConfigurationEtag &&\n this.etag !== response.xMsQpsConfigurationEtag\n ) {\n this.updateConfiguration(response);\n }\n\n const endpointRedirect = response.xMsQpsServiceEndpointRedirectV2;\n if (endpointRedirect) {\n this.pingSender.handlePermanentRedirect(endpointRedirect);\n this.quickpulseExporter.getSender().handlePermanentRedirect(endpointRedirect);\n }\n const pollingInterval = response.xMsQpsServicePollingIntervalHint;\n if (pollingInterval) {\n this.pingInterval = Number(pollingInterval);\n } else {\n this.pingInterval = PING_INTERVAL;\n }\n\n if (!this.isCollectingData && (this.meterProvider || this.isDeactivating)) {\n this.etag = \"\";\n this.quickpulseExporter.setEtag(\"\");\n await this.restartMetrics(false);\n } else if (this.isCollectingData && wasBackingOff && !this.isDeactivating) {\n await this.restartMetrics();\n }\n }\n }\n\n private async restartMetrics(preserveConfiguration = true): Promise<void> {\n // A reader's interval is fixed at construction. Preserve collection state when\n // replacing it, and let the shutdown flush update the desired interval.\n try {\n await this.deactivateMetrics(preserveConfiguration);\n } catch (error) {\n Logger.getInstance().warn(\"Failed to restart Live Metrics collection\", error);\n }\n if (this.isCollectingData) {\n this.activateMetrics({ collectionInterval: this.postInterval });\n } else {\n this.schedulePing();\n }\n }\n\n // Activate live metrics collection\n public activateMetrics(options?: { collectionInterval: number }): void {\n if (this.meterProvider || this.isDeactivating || this.isShutdown) {\n return;\n }\n // Turn on live metrics active collection for statsbeat\n if (!this.statsbeatOptionsUpdated) {\n getInstance().setStatsbeatFeatures({}, { liveMetrics: true });\n this.statsbeatOptionsUpdated = true;\n }\n // Reader replacement must retain both totals and sampling baselines so\n // telemetry recorded during the final flush is collected exactly once.\n if (this.resetCountersOnActivation) {\n this.totalDependencyCount = 0;\n this.totalExceptionCount = 0;\n this.totalFailedDependencyCount = 0;\n this.totalFailedRequestCount = 0;\n this.totalRequestCount = 0;\n this.requestDuration = 0;\n this.dependencyDuration = 0;\n this.lastRequestDuration = { count: 0, duration: 0, time: 0 };\n this.lastRequestRate = { count: 0, time: 0 };\n this.lastFailedRequestRate = { count: 0, time: 0 };\n this.lastDependencyDuration = { count: 0, duration: 0, time: 0 };\n this.lastDependencyRate = { count: 0, time: 0 };\n this.lastFailedDependencyRate = { count: 0, time: 0 };\n this.lastExceptionRate = { count: 0, time: 0 };\n this.resetCountersOnActivation = false;\n }\n\n const metricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.quickpulseExporter,\n exportIntervalMillis: options?.collectionInterval,\n };\n this.metricReader = new PeriodicExportingMetricReader(metricReaderOptions);\n const meterProviderConfig: MeterProviderOptions = {\n resource: this.config.resource,\n readers: [this.metricReader],\n };\n this.meterProvider = new MeterProvider(meterProviderConfig);\n this.meter = this.meterProvider.getMeter(\"AzureMonitorLiveMetricsMeter\");\n this.requestDurationGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_DURATION,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.requestRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.requestFailedRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.REQUEST_FAILURE_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyDurationGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_DURATION,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.dependencyFailedRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.DEPENDENCY_FAILURE_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n\n this.processPhysicalBytesGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.PHYSICAL_BYTES,\n {\n valueType: ValueType.INT,\n },\n );\n\n this.percentProcessorTimeNormalizedGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.PROCESSOR_TIME_NORMALIZED,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n this.exceptionsRateGauge = this.meter.createObservableGauge(\n QuickPulseOpenTelemetryMetricNames.EXCEPTION_RATE,\n {\n valueType: ValueType.DOUBLE,\n },\n );\n\n this.requestDurationGauge.addCallback(this.getRequestDuration.bind(this));\n this.requestRateGauge.addCallback(this.getRequestRate.bind(this));\n this.requestFailedRateGauge.addCallback(this.getRequestFailedRate.bind(this));\n this.dependencyDurationGauge.addCallback(this.getDependencyDuration.bind(this));\n this.dependencyRateGauge.addCallback(this.getDependencyRate.bind(this));\n this.dependencyFailedRateGauge.addCallback(this.getDependencyFailedRate.bind(this));\n this.exceptionsRateGauge.addCallback(this.getExceptionRate.bind(this));\n this.processPhysicalBytesGauge.addCallback(this.getPhysicalMemory.bind(this));\n this.percentProcessorTimeNormalizedGauge.addCallback(\n this.getProcessorTimeNormalized.bind(this),\n );\n }\n\n /**\n * Deactivate metric collection\n */\n public async deactivateMetrics(preserveConfiguration = false): Promise<void> {\n if (!preserveConfiguration) {\n this.resetCountersOnActivation = true;\n this.documents = [];\n this.validDocumentFilterConjuctionGroupInfos.clear();\n this.errorTracker.clearRunTimeErrors();\n this.errorTracker.clearValidationTimeErrors();\n this.validDerivedMetrics.clear();\n this.derivedMetricProjection.clearProjectionMaps();\n this.seenMetricIds.clear();\n }\n // Coalesce concurrent deactivations: callers (shutdown(), the\n // failure-fallback in quickPulseDone(), and the \"unsubscribed\" branch in\n // goQuickpulse()) can all race. Return the in-flight promise so every\n // caller awaits the same completion and the underlying meterProvider\n // shutdown only runs once.\n if (this.deactivatingPromise) {\n return this.deactivatingPromise;\n }\n this.isDeactivating = true;\n this.deactivatingPromise = (async () => {\n try {\n // Capture and clear the reference before awaiting shutdown so any\n // re-entrant calls triggered by the shutdown's final force-flush\n // export observe meterProvider as undefined and exit early.\n const provider = this.meterProvider;\n this.meterProvider = undefined;\n await provider?.shutdown();\n } finally {\n this.isDeactivating = false;\n this.deactivatingPromise = undefined;\n }\n })();\n return this.deactivatingPromise;\n }\n\n /**\n * Force flush Meter Provider.\n */\n public async flush(): Promise<void> {\n await this.meterProvider?.forceFlush();\n }\n\n /**\n *Get OpenTelemetry MeterProvider\n */\n public getMeterProvider(): MeterProvider | undefined {\n return this.meterProvider;\n }\n\n public getDocuments(): DocumentIngress[] {\n const result: DocumentIngress[] = this.documents;\n this.documents = [];\n return result;\n }\n\n public getErrors(): CollectionConfigurationError[] {\n const result = this.errorTracker.getErrors();\n this.errorTracker.clearRunTimeErrors();\n return result;\n }\n\n public getDerivedMetricValues(): Map<string, number> {\n return this.derivedMetricProjection.getMetricValues();\n }\n\n private addDocument(document: DocumentIngress): void {\n if (document) {\n // Limit risk of memory leak by limiting doc length to something manageable\n if (this.documents.length > 20) {\n this.documents.shift(); // Remove oldest document\n }\n this.documents.push(document);\n }\n }\n\n /**\n * Record Span metrics\n * @internal\n */\n public recordSpan(span: ReadableSpan): void {\n if (this.isCollectingData) {\n const columns: RequestData | DependencyData = getSpanData(span);\n let documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>;\n let derivedMetricInfos: DerivedMetricInfo[];\n if (isRequestData(columns)) {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Request\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n derivedMetricInfos = this.validDerivedMetrics.get(\"Request\") || [];\n } else {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Dependency\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n derivedMetricInfos = this.validDerivedMetrics.get(\"Dependency\") || [];\n }\n this.applyDocumentFilters(documentConfiguration, columns);\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, columns);\n\n const durationMs = hrTimeToMilliseconds(span.duration);\n const success = span.status.code !== SpanStatusCode.ERROR;\n\n if (span.kind === SpanKind.SERVER || span.kind === SpanKind.CONSUMER) {\n this.totalRequestCount++;\n this.requestDuration += durationMs;\n if (!success) {\n this.totalFailedRequestCount++;\n }\n } else {\n this.totalDependencyCount++;\n this.dependencyDuration += durationMs;\n if (!success) {\n this.totalFailedDependencyCount++;\n }\n }\n if (span.events) {\n span.events.forEach((event: TimedEvent) => {\n event.attributes = event.attributes || {};\n if (event.name === \"exception\") {\n const exceptionColumns: ExceptionData = getSpanExceptionColumns(\n event.attributes,\n span.attributes,\n );\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Exception\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(\n documentConfiguration,\n exceptionColumns,\n event.attributes[SEMATTRS_EXCEPTION_TYPE] as string,\n );\n derivedMetricInfos = this.validDerivedMetrics.get(\"Exception\") || [];\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, exceptionColumns);\n this.totalExceptionCount++;\n }\n });\n }\n }\n }\n\n /**\n * Record LogRecord metrics, add attribute so data is not aggregated again in ingestion\n * @internal\n */\n public recordLog(logRecord: SdkLogRecord): void {\n if (this.isCollectingData) {\n const columns: TraceData | ExceptionData = getLogData(logRecord);\n let derivedMetricInfos: DerivedMetricInfo[];\n let documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>;\n if (isExceptionData(columns)) {\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Exception\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(\n documentConfiguration,\n columns,\n logRecord.attributes[SEMATTRS_EXCEPTION_TYPE] as string,\n );\n derivedMetricInfos = this.validDerivedMetrics.get(\"Exception\") || [];\n this.totalExceptionCount++;\n } else {\n // trace\n documentConfiguration =\n this.validDocumentFilterConjuctionGroupInfos.get(\"Trace\") ||\n new Map<string, FilterConjunctionGroupInfo[]>();\n this.applyDocumentFilters(documentConfiguration, columns);\n derivedMetricInfos = this.validDerivedMetrics.get(\"Trace\") || [];\n }\n this.checkMetricFilterAndCreateProjection(derivedMetricInfos, columns);\n }\n }\n\n private getRequestDuration(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const requestInterval = this.totalRequestCount - this.lastRequestDuration.count || 0;\n const durationInterval = this.requestDuration - this.lastRequestDuration.duration || 0;\n const elapsedMs = currentTime - this.lastRequestDuration.time;\n if (elapsedMs > 0) {\n const averageExecutionTime = durationInterval / requestInterval || 0; // default to 0 in case no requests in this interval\n observableResult.observe(averageExecutionTime);\n }\n this.lastRequestDuration = {\n count: this.totalRequestCount,\n duration: this.requestDuration,\n time: currentTime,\n };\n }\n\n private getRequestRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalRequestCount - this.lastRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastRequestRate = {\n count: this.totalRequestCount,\n time: currentTime,\n };\n }\n\n private getRequestFailedRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalFailedRequestCount - this.lastFailedRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastFailedRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastFailedRequestRate = {\n count: this.totalFailedRequestCount,\n time: currentTime,\n };\n }\n\n private getDependencyDuration(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const dependencyInterval = this.totalDependencyCount - this.lastDependencyDuration.count || 0;\n const durationInterval = this.dependencyDuration - this.lastDependencyDuration.duration || 0;\n const elapsedMs = currentTime - this.lastDependencyDuration.time;\n if (elapsedMs > 0) {\n const averageExecutionTime = durationInterval / dependencyInterval || 0; // default to 0 in case no dependencies in this interval\n observableResult.observe(averageExecutionTime);\n }\n this.lastDependencyDuration = {\n count: this.totalDependencyCount,\n duration: this.dependencyDuration,\n time: currentTime,\n };\n }\n\n private getDependencyRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalDependencyCount - this.lastDependencyRate.count || 0;\n const elapsedMs = currentTime - this.lastDependencyRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastDependencyRate = {\n count: this.totalDependencyCount,\n time: currentTime,\n };\n }\n\n private getDependencyFailedRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalFailedDependencyCount - this.lastFailedDependencyRate.count || 0;\n const elapsedMs = currentTime - this.lastFailedDependencyRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastFailedDependencyRate = {\n count: this.totalFailedDependencyCount,\n time: currentTime,\n };\n }\n\n private getExceptionRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalExceptionCount - this.lastExceptionRate.count || 0;\n const elapsedMs = currentTime - this.lastExceptionRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastExceptionRate = {\n count: this.totalExceptionCount,\n time: currentTime,\n };\n }\n\n private getPhysicalMemory(observableResult: ObservableResult): void {\n const rss = getPhysicalMemory();\n observableResult.observe(rss);\n }\n\n private getProcessorTimeNormalized(observableResult: ObservableResult): void {\n if (process && process.hrtime) {\n const cpuUsagePercent = getProcessorTimeNormalized(this.lastHrTime, this.lastCpuUsage);\n observableResult.observe(cpuUsagePercent);\n this.lastHrTime = process.hrtime.bigint();\n this.lastCpuUsage = process.cpuUsage();\n } else {\n Logger.getInstance().debug(\"Getting Normalized Processor Time Failed. No process available.\");\n }\n }\n\n private updateConfiguration(response: QuickpulseResponse): void {\n this.etag = response.xMsQpsConfigurationEtag || \"\";\n this.quickpulseExporter.setEtag(this.etag);\n this.errorTracker.clearValidationTimeErrors();\n this.validDocumentFilterConjuctionGroupInfos.clear();\n this.validDerivedMetrics.clear();\n this.derivedMetricProjection.clearProjectionMaps();\n this.seenMetricIds.clear();\n\n this.parseDocumentFilterConfiguration(response);\n this.parseMetricFilterConfiguration(response);\n }\n\n private parseDocumentFilterConfiguration(response: QuickpulseResponse): void {\n if (!response?.documentStreams || typeof response.documentStreams.forEach !== \"function\") {\n return;\n }\n response.documentStreams.forEach((documentStreamInfo) => {\n documentStreamInfo.documentFilterGroups.forEach((documentFilterGroupInfo) => {\n try {\n this.validator.validateTelemetryType(documentFilterGroupInfo.telemetryType);\n this.validator.validateDocumentFilters(documentFilterGroupInfo);\n this.filter.renameExceptionFieldNamesForFiltering(documentFilterGroupInfo.filters);\n\n if (\n !this.validDocumentFilterConjuctionGroupInfos.has(documentFilterGroupInfo.telemetryType)\n ) {\n this.validDocumentFilterConjuctionGroupInfos.set(\n documentFilterGroupInfo.telemetryType,\n new Map<string, FilterConjunctionGroupInfo[]>(),\n );\n }\n\n const innerMap = this.validDocumentFilterConjuctionGroupInfos.get(\n documentFilterGroupInfo.telemetryType,\n );\n if (!innerMap?.has(documentStreamInfo.id)) {\n innerMap?.set(documentStreamInfo.id, [documentFilterGroupInfo.filters]);\n } else {\n innerMap.get(documentStreamInfo.id)?.push(documentFilterGroupInfo.filters);\n }\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof TelemetryTypeError) {\n configError.collectionConfigurationErrorType =\n \"CollectionConfigurationFailureToCreateUnexpected\";\n } else if (error instanceof UnexpectedFilterCreateError) {\n configError.collectionConfigurationErrorType =\n \"DocumentStreamFailureToCreateFilterUnexpected\";\n }\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const data: KeyValuePairStringString[] = [];\n data.push({ key: \"DocumentStreamInfoId\", value: documentStreamInfo.id });\n data.push({ key: \"ETag\", value: this.etag });\n configError.data = data;\n this.errorTracker.addValidationError(configError);\n }\n });\n });\n }\n\n private applyDocumentFilters(\n documentConfiguration: Map<string, FilterConjunctionGroupInfo[]>,\n data: TelemetryData,\n exceptionType?: string,\n ): void {\n const streamIds: Set<string> = new Set<string>();\n documentConfiguration.forEach((filterConjunctionGroupInfoList, streamId) => {\n filterConjunctionGroupInfoList.forEach((filterConjunctionGroupInfo) => {\n // by going though each filterConjuctionGroupInfo, we are implicitly -OR-ing\n // different filterConjunctionGroupInfo within documentStreamInfo. If there are multiple\n // documentStreamInfos, this logic will -OR- the filtering results of each documentStreamInfo.\n if (this.filter.checkFilterConjunctionGroup(filterConjunctionGroupInfo, data)) {\n streamIds.add(streamId);\n }\n });\n });\n\n // Emit a document when a telemetry data matches a particular filtering configuration,\n // or when filtering configuration is empty.\n if (streamIds.size > 0 || documentConfiguration.size === 0) {\n let document: Request | RemoteDependency | Trace | Exception;\n if (isRequestData(data) || isDependencyData(data)) {\n document = getSpanDocument(data);\n } else if (isExceptionData(data) && exceptionType) {\n document = getLogDocument(data, exceptionType);\n } else {\n document = getLogDocument(data);\n }\n document.documentStreamIds = [...streamIds];\n this.addDocument(document);\n }\n }\n\n private parseMetricFilterConfiguration(response: QuickpulseResponse): void {\n if (!response.metrics || typeof response.metrics.forEach !== \"function\") {\n return;\n }\n response.metrics.forEach((derivedMetricInfo) => {\n try {\n if (!this.seenMetricIds.has(derivedMetricInfo.id)) {\n this.seenMetricIds.add(derivedMetricInfo.id);\n this.validator.validateTelemetryType(derivedMetricInfo.telemetryType);\n this.validator.checkCustomMetricProjection(derivedMetricInfo);\n this.validator.validateMetricFilters(derivedMetricInfo);\n derivedMetricInfo.filterGroups.forEach((filterConjunctionGroupInfo) => {\n this.filter.renameExceptionFieldNamesForFiltering(filterConjunctionGroupInfo);\n });\n\n if (this.validDerivedMetrics.has(derivedMetricInfo.telemetryType)) {\n this.validDerivedMetrics.get(derivedMetricInfo.telemetryType)?.push(derivedMetricInfo);\n } else {\n this.validDerivedMetrics.set(derivedMetricInfo.telemetryType, [derivedMetricInfo]);\n }\n } else {\n throw new DuplicateMetricIdError(`Duplicate Metric Id: ${derivedMetricInfo.id}`);\n }\n this.derivedMetricProjection.initDerivedMetricProjection(derivedMetricInfo);\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof TelemetryTypeError) {\n configError.collectionConfigurationErrorType = \"MetricTelemetryTypeUnsupported\";\n } else if (error instanceof UnexpectedFilterCreateError) {\n configError.collectionConfigurationErrorType = \"MetricFailureToCreateFilterUnexpected\";\n } else if (error instanceof DuplicateMetricIdError) {\n configError.collectionConfigurationErrorType = \"MetricDuplicateIds\";\n }\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const data: KeyValuePairStringString[] = [];\n data.push({ key: \"MetricId\", value: derivedMetricInfo.id });\n data.push({ key: \"ETag\", value: this.etag });\n configError.data = data;\n this.errorTracker.addValidationError(configError);\n }\n });\n }\n\n private checkMetricFilterAndCreateProjection(\n derivedMetricInfoList: DerivedMetricInfo[],\n data: TelemetryData,\n ): void {\n derivedMetricInfoList.forEach((derivedMetricInfo: DerivedMetricInfo) => {\n if (this.filter.checkMetricFilters(derivedMetricInfo, data)) {\n try {\n this.derivedMetricProjection.calculateProjection(derivedMetricInfo, data);\n } catch (error) {\n const configError: CollectionConfigurationError = {\n collectionConfigurationErrorType: \"Unknown\",\n message: \"\",\n fullException: \"\",\n data: [],\n };\n if (error instanceof MetricFailureToCreateError) {\n configError.collectionConfigurationErrorType = \"MetricFailureToCreate\";\n\n if (error instanceof Error) {\n configError.message = error.message;\n configError.fullException = error.stack || \"\";\n }\n const errorData: KeyValuePairStringString[] = [];\n errorData.push({ key: \"MetricId\", value: derivedMetricInfo.id });\n errorData.push({ key: \"ETag\", value: this.etag });\n configError.data = errorData;\n this.errorTracker.addRunTimeError(configError);\n }\n }\n }\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AzureSdkInstrumentation as BaseAzureSdkInstrumentation } from "@azure/opentelemetry-instrumentation-azure-sdk";
|
|
2
|
+
import type { InstrumentationModuleDefinition } from "@opentelemetry/instrumentation";
|
|
3
|
+
/**
|
|
4
|
+
* Keep both eager and module-hook bridges tied to the distro's instrumentation
|
|
5
|
+
* lifecycle without changing the shared Azure SDK instrumentation package.
|
|
6
|
+
* Context activation remains available when instrumentation is disabled.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class AzureSdkInstrumentation extends BaseAzureSdkInstrumentation {
|
|
10
|
+
protected init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=azureSdkInstrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azureSdkInstrumentation.d.ts","sourceRoot":"","sources":["../../../src/traces/azureSdkInstrumentation.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,uBAAuB,IAAI,2BAA2B,EAEvD,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AAmCtF;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,2BAA2B;cACnD,IAAI,IACrB,+BAA+B,GAAG,+BAA+B,EAAE,GAAG,IAAI;CAgB7E"}
|