@azure/monitor-opentelemetry-exporter 1.0.0-beta.18 → 1.0.0-beta.19

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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +334 -332
  3. package/dist-esm/src/export/log.js.map +1 -1
  4. package/dist-esm/src/export/metric.js.map +1 -1
  5. package/dist-esm/src/export/statsbeat/longIntervalStatsbeatMetrics.js +1 -1
  6. package/dist-esm/src/export/statsbeat/longIntervalStatsbeatMetrics.js.map +1 -1
  7. package/dist-esm/src/export/statsbeat/networkStatsbeatMetrics.js +1 -1
  8. package/dist-esm/src/export/statsbeat/networkStatsbeatMetrics.js.map +1 -1
  9. package/dist-esm/src/export/statsbeat/statsbeatExporter.js +1 -2
  10. package/dist-esm/src/export/statsbeat/statsbeatExporter.js.map +1 -1
  11. package/dist-esm/src/export/trace.js.map +1 -1
  12. package/dist-esm/src/generated/applicationInsightsClient.js +13 -30
  13. package/dist-esm/src/generated/applicationInsightsClient.js.map +1 -1
  14. package/dist-esm/src/generated/models/index.js.map +1 -1
  15. package/dist-esm/src/generated/models/mappers.js +276 -276
  16. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  17. package/dist-esm/src/generated/models/parameters.js +14 -14
  18. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  19. package/dist-esm/src/platform/nodejs/baseSender.js +20 -6
  20. package/dist-esm/src/platform/nodejs/baseSender.js.map +1 -1
  21. package/dist-esm/src/platform/nodejs/persist/fileAccessControl.js.map +1 -1
  22. package/dist-esm/src/platform/nodejs/persist/fileSystemPersist.js.map +1 -1
  23. package/dist-esm/src/sampling.js.map +1 -1
  24. package/dist-esm/src/utils/common.js.map +1 -1
  25. package/dist-esm/src/utils/connectionStringParser.js.map +1 -1
  26. package/dist-esm/src/utils/constants/applicationinsights.js +2 -1
  27. package/dist-esm/src/utils/constants/applicationinsights.js.map +1 -1
  28. package/dist-esm/src/utils/eventhub.js.map +1 -1
  29. package/dist-esm/src/utils/metricUtils.js.map +1 -1
  30. package/dist-esm/src/utils/spanUtils.js +6 -1
  31. package/dist-esm/src/utils/spanUtils.js.map +1 -1
  32. package/package.json +16 -17
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/export/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,wBAAwB;IAOnE;;;OAGG;IAEH,YAAY,UAAuC,EAAE;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAZjB;;WAEG;QACK,gBAAW,GAAG,KAAK,CAAC;QAU1B,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,OAAO;YACxB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CACjB,IAAyB,EACzB,cAA8C;QAE9C,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;YACzD,UAAU,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACvE,OAAO;SACR;QACD,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,MAAM,sCAAsC,CAAC,CAAC;QAE1E,MAAM,SAAS,GAAe,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC7D,IAAI,QAAQ,EAAE;gBACZ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC1B;QACH,CAAC,CAAC,CAAC;QACH,0DAA0D;QAC1D,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE;YAC/D,cAAc,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context, diag } from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { logToEnvelope } from \"../utils/logUtils\";\nimport { AzureMonitorExporterOptions } from \"../config\";\n\nimport type { ReadableLogRecord, LogRecordExporter } from \"@opentelemetry/sdk-logs\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Log Exporter.\n */\nexport class AzureMonitorLogExporter extends AzureMonitorBaseExporter implements LogRecordExporter {\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private _isShutdown = false;\n private readonly _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorLogExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorLogExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry logs.\n * @param logs - Logs to export.\n * @param resultCallback - Result callback.\n */\n public async export(\n logs: ReadableLogRecord[],\n resultCallback: (result: ExportResult) => void\n ): Promise<void> {\n if (this._isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n diag.info(`Exporting ${logs.length} logs(s). Converting to envelopes...`);\n\n const envelopes: Envelope[] = [];\n logs.forEach((log) => {\n const envelope = logToEnvelope(log, this.instrumentationKey);\n if (envelope) {\n envelopes.push(envelope);\n }\n });\n // Supress tracing until OpenTelemetry Logs SDK support it\n await context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorLogExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n diag.info(\"AzureMonitorLogExporter shutting down\");\n return this._sender.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/export/log.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC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AQ,CAAC,CAAC;aAC1B;QACH,CAAC,CAAC,CAAC;QACH,0DAA0D;QAC1D,MAAM,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE;YAC/D,cAAc,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context, diag } from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { logToEnvelope } from \"../utils/logUtils\";\nimport { AzureMonitorExporterOptions } from \"../config\";\n\nimport type { ReadableLogRecord, LogRecordExporter } from \"@opentelemetry/sdk-logs\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Log Exporter.\n */\nexport class AzureMonitorLogExporter extends AzureMonitorBaseExporter implements LogRecordExporter {\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private _isShutdown = false;\n private readonly _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorLogExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorLogExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry logs.\n * @param logs - Logs to export.\n * @param resultCallback - Result callback.\n */\n public async export(\n logs: ReadableLogRecord[],\n resultCallback: (result: ExportResult) => void,\n ): Promise<void> {\n if (this._isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n diag.info(`Exporting ${logs.length} logs(s). Converting to envelopes...`);\n\n const envelopes: Envelope[] = [];\n logs.forEach((log) => {\n const envelope = logToEnvelope(log, this.instrumentationKey);\n if (envelope) {\n envelopes.push(envelope);\n }\n });\n // Supress tracing until OpenTelemetry Logs SDK support it\n await context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorLogExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n diag.info(\"AzureMonitorLogExporter shutting down\");\n return this._sender.shutdown();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/export/metric.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,cAAc,GAGf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,0BACX,SAAQ,wBAAwB;IAShC;;;OAGG;IAEH,YAAY,UAAuC,EAAE;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAZjB;;WAEG;QACK,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;OAEG;IACI,4BAA4B,CAAC,cAA8B;QAChE,IACE,cAAc,KAAK,cAAc,CAAC,eAAe;YACjD,cAAc,KAAK,cAAc,CAAC,0BAA0B,EAC5D;YACA,OAAO,sBAAsB,CAAC,UAAU,CAAC;SAC1C;QACD,OAAO,sBAAsB,CAAC,KAAK,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context, diag } from \"@opentelemetry/api\";\nimport {\n AggregationTemporality,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n} from \"@opentelemetry/sdk-metrics\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { resourceMetricsToEnvelope } from \"../utils/metricUtils\";\nimport { AzureMonitorExporterOptions } from \"../config\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Metric Exporter.\n */\nexport class AzureMonitorMetricExporter\n extends AzureMonitorBaseExporter\n implements PushMetricExporter\n{\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private _isShutdown = false;\n private _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorMetricExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorMetricExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry resource metrics.\n * @param metrics - Resource metrics to export.\n * @param resultCallback - Result callback.\n */\n async export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void\n ): Promise<void> {\n if (this._isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n diag.info(`Exporting ${metrics.scopeMetrics.length} metrics(s). Converting to envelopes...`);\n\n const envelopes: Envelope[] = resourceMetricsToEnvelope(metrics, this.instrumentationKey);\n // Supress tracing until OpenTelemetry Metrics SDK support it\n await context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorMetricExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n diag.info(\"AzureMonitorMetricExporter shutting down\");\n return this._sender.shutdown();\n }\n\n /**\n * Select aggregation temporality\n */\n public selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n if (\n instrumentType === InstrumentType.UP_DOWN_COUNTER ||\n instrumentType === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER\n ) {\n return AggregationTemporality.CUMULATIVE;\n }\n return AggregationTemporality.DELTA;\n }\n\n /**\n * Force flush\n */\n public async forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n"]}
1
+ {"version":3,"file":"metric.js","sourceRoot":"","sources":["../../../src/export/metric.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,sBAAsB,EACtB,cAAc,GAGf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,0BACX,SAAQ,wBAAw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AAC,0CAA0C,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,4BAA4B,CAAC,cAA8B;QAChE,IACE,cAAc,KAAK,cAAc,CAAC,eAAe;YACjD,cAAc,KAAK,cAAc,CAAC,0BAA0B,EAC5D;YACA,OAAO,sBAAsB,CAAC,UAAU,CAAC;SAC1C;QACD,OAAO,sBAAsB,CAAC,KAAK,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context, diag } from \"@opentelemetry/api\";\nimport {\n AggregationTemporality,\n InstrumentType,\n PushMetricExporter,\n ResourceMetrics,\n} from \"@opentelemetry/sdk-metrics\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { resourceMetricsToEnvelope } from \"../utils/metricUtils\";\nimport { AzureMonitorExporterOptions } from \"../config\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Metric Exporter.\n */\nexport class AzureMonitorMetricExporter\n extends AzureMonitorBaseExporter\n implements PushMetricExporter\n{\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private _isShutdown = false;\n private _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorMetricExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorMetricExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry resource metrics.\n * @param metrics - Resource metrics to export.\n * @param resultCallback - Result callback.\n */\n async export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void,\n ): Promise<void> {\n if (this._isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n diag.info(`Exporting ${metrics.scopeMetrics.length} metrics(s). Converting to envelopes...`);\n\n const envelopes: Envelope[] = resourceMetricsToEnvelope(metrics, this.instrumentationKey);\n // Supress tracing until OpenTelemetry Metrics SDK support it\n await context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorMetricExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n diag.info(\"AzureMonitorMetricExporter shutting down\");\n return this._sender.shutdown();\n }\n\n /**\n * Select aggregation temporality\n */\n public selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {\n if (\n instrumentType === InstrumentType.UP_DOWN_COUNTER ||\n instrumentType === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER\n ) {\n return AggregationTemporality.CUMULATIVE;\n }\n return AggregationTemporality.DELTA;\n }\n\n /**\n * Force flush\n */\n public async forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n"]}
@@ -17,7 +17,7 @@ class LongIntervalStatsbeatMetrics extends StatsbeatMetrics {
17
17
  super();
18
18
  this.AZURE_MONITOR_STATSBEAT_FEATURES = process.env.AZURE_MONITOR_STATSBEAT_FEATURES;
19
19
  this.statsCollectionLongInterval = 86400000; // 1 day
20
- this.attach = "sdk";
20
+ this.attach = "Manual";
21
21
  this.feature = 0;
22
22
  this.instrumentation = 0;
23
23
  this.isInitialized = false;
@@ -1 +1 @@
1
- {"version":3,"file":"longIntervalStatsbeatMetrics.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/longIntervalStatsbeatMetrics.ts"],"names":[],"mappings":"AAAA,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AC,gBAAgB,KACxB,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,IAAI,EAAE,oBAAoB,CAAC,eAAe,GAC3C,CAAC;YACF,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,oBAAO,UAAU,EAAG,CAAC;SAC5E;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,UAAU,mCACL,IAAI,CAAC,gBAAgB,KACxB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAE,oBAAoB,CAAC,OAAO,GACnC,CAAC;YACF,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,oBAAO,UAAU,EAAG,CAAC;SAC5E;IACH,CAAC;IAEO,cAAc,CAAC,gBAAkC;QACvD,MAAM,UAAU,mCAAQ,IAAI,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,CAAE,CAAC;QAC1E,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,kCAAkC,CAAC,QAAQ,EAAE,CAAC;IAC5D,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC;KACtD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n diag,\n BatchObservableResult,\n ObservableGauge,\n ObservableResult,\n Meter,\n} from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode } from \"@opentelemetry/core\";\nimport {\n MeterProvider,\n PeriodicExportingMetricReader,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { AzureMonitorExporterOptions } from \"../../index\";\nimport * as ai from \"../../utils/constants/applicationinsights\";\nimport { StatsbeatMetrics } from \"./statsbeatMetrics\";\nimport {\n StatsbeatCounter,\n STATSBEAT_LANGUAGE,\n CommonStatsbeatProperties,\n AttachStatsbeatProperties,\n StatsbeatFeatureType,\n StatsbeatOptions,\n} from \"./types\";\nimport { AzureMonitorStatsbeatExporter } from \"./statsbeatExporter\";\n\nlet instance: LongIntervalStatsbeatMetrics | null = null;\n\n/**\n * Long Interval Statsbeat Metrics\n * @internal\n */\nclass LongIntervalStatsbeatMetrics extends StatsbeatMetrics {\n private AZURE_MONITOR_STATSBEAT_FEATURES = process.env.AZURE_MONITOR_STATSBEAT_FEATURES;\n private statsCollectionLongInterval: number = 86400000; // 1 day\n // Custom dimensions\n private cikey: string;\n private runtimeVersion: string;\n private language: string;\n private version: string;\n private attach: string = \"sdk\";\n\n private commonProperties: CommonStatsbeatProperties;\n private attachProperties: AttachStatsbeatProperties;\n\n private feature: number = 0;\n private instrumentation: number = 0;\n\n private longIntervalStatsbeatMeterProvider: MeterProvider;\n private longIntervalAzureExporter: AzureMonitorStatsbeatExporter;\n private longIntervalMetricReader: PeriodicExportingMetricReader;\n private longIntervalStatsbeatMeter: Meter;\n\n // Network Attributes\n private connectionString: string;\n\n // Observable Gauges\n private featureStatsbeatGauge: ObservableGauge;\n private attachStatsbeatGauge: ObservableGauge;\n\n public isInitialized: boolean = false;\n\n constructor(options: StatsbeatOptions) {\n super();\n this.connectionString = super.getConnectionString(options.endpointUrl);\n const exporterConfig: AzureMonitorExporterOptions = {\n connectionString: this.connectionString,\n };\n\n if (this.AZURE_MONITOR_STATSBEAT_FEATURES) {\n try {\n this.feature = JSON.parse(this.AZURE_MONITOR_STATSBEAT_FEATURES).feature;\n this.instrumentation = JSON.parse(this.AZURE_MONITOR_STATSBEAT_FEATURES).instrumentation;\n } catch (error: any) {\n diag.error(\n `LongIntervalStatsbeat: Failed to parse features/instrumentations (error ${error})`\n );\n }\n }\n\n this.longIntervalStatsbeatMeterProvider = new MeterProvider();\n this.longIntervalAzureExporter = new AzureMonitorStatsbeatExporter(exporterConfig);\n\n // Export Long Interval Statsbeats every day\n const longIntervalMetricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.longIntervalAzureExporter,\n exportIntervalMillis:\n Number(process.env.LONG_INTERVAL_EXPORT_MILLIS) || this.statsCollectionLongInterval, // 1 day\n };\n\n this.longIntervalMetricReader = new PeriodicExportingMetricReader(\n longIntervalMetricReaderOptions\n );\n this.longIntervalStatsbeatMeterProvider.addMetricReader(this.longIntervalMetricReader);\n this.longIntervalStatsbeatMeter = this.longIntervalStatsbeatMeterProvider.getMeter(\n \"Azure Monitor Long Interval Statsbeat\"\n );\n\n // Assign Common Properties\n this.runtimeVersion = process.version;\n this.language = STATSBEAT_LANGUAGE;\n this.version = ai.packageVersion;\n this.cikey = options.instrumentationKey;\n\n this.featureStatsbeatGauge = this.longIntervalStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.FEATURE\n );\n this.attachStatsbeatGauge = this.longIntervalStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.ATTACH\n );\n\n this.commonProperties = {\n os: super.os,\n rp: super.resourceProvider,\n cikey: this.cikey,\n runtimeVersion: this.runtimeVersion,\n language: this.language,\n version: this.version,\n attach: this.attach,\n };\n\n this.attachProperties = {\n rpId: super.resourceIdentifier,\n };\n\n this.isInitialized = true;\n this.initialize();\n }\n\n private async initialize() {\n try {\n await this.getResourceProvider();\n\n // Add long interval observable callbacks\n this.attachStatsbeatGauge.addCallback(this.attachCallback.bind(this));\n this.longIntervalStatsbeatMeter.addBatchObservableCallback(this.featureCallback.bind(this), [\n this.featureStatsbeatGauge,\n ]);\n\n // Export Feature/Attach Statsbeat once upon app initialization\n this.longIntervalAzureExporter.export(\n (await this.longIntervalMetricReader.collect()).resourceMetrics,\n (result: ExportResult) => {\n if (result.code !== ExportResultCode.SUCCESS) {\n diag.error(`LongIntervalStatsbeat: metrics export failed (error ${result.error})`);\n }\n }\n );\n } catch (error) {\n diag.debug(\"Call to get the resource provider failed.\");\n }\n }\n\n private featureCallback(observableResult: BatchObservableResult) {\n let attributes;\n if (this.instrumentation) {\n attributes = {\n ...this.commonProperties,\n feature: this.instrumentation,\n type: StatsbeatFeatureType.INSTRUMENTATION,\n };\n observableResult.observe(this.featureStatsbeatGauge, 1, { ...attributes });\n }\n\n if (this.feature) {\n attributes = {\n ...this.commonProperties,\n feature: this.feature,\n type: StatsbeatFeatureType.FEATURE,\n };\n observableResult.observe(this.featureStatsbeatGauge, 1, { ...attributes });\n }\n }\n\n private attachCallback(observableResult: ObservableResult) {\n const attributes = { ...this.commonProperties, ...this.attachProperties };\n observableResult.observe(1, attributes);\n }\n\n public shutdown(): Promise<void> {\n return this.longIntervalStatsbeatMeterProvider.shutdown();\n }\n}\n\n/**\n * Singleton LongIntervalStatsbeatMetrics instance.\n * @internal\n */\nexport function getInstance(options: StatsbeatOptions): LongIntervalStatsbeatMetrics {\n if (!instance) {\n instance = new LongIntervalStatsbeatMetrics(options);\n }\n return instance;\n}\n"]}
1
+ {"version":3,"file":"longIntervalStatsbeatMetrics.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/longIntervalStatsbeatMetrics.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,IAAI,GAKL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EACL,aAAa,EACb,6BAA6B,GAE9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAGlB,oBAAoB,GAErB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,IAAI,QAAQ,GAAwC,IAAI,CAAC;AAEzD;;;GAGG;AACH,MA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BAAkC;QACvD,MAAM,UAAU,mCAAQ,IAAI,CAAC,gBAAgB,GAAK,IAAI,CAAC,gBAAgB,CAAE,CAAC;QAC1E,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,kCAAkC,CAAC,QAAQ,EAAE,CAAC;IAC5D,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC;KACtD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n diag,\n BatchObservableResult,\n ObservableGauge,\n ObservableResult,\n Meter,\n} from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode } from \"@opentelemetry/core\";\nimport {\n MeterProvider,\n PeriodicExportingMetricReader,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { AzureMonitorExporterOptions } from \"../../index\";\nimport * as ai from \"../../utils/constants/applicationinsights\";\nimport { StatsbeatMetrics } from \"./statsbeatMetrics\";\nimport {\n StatsbeatCounter,\n STATSBEAT_LANGUAGE,\n CommonStatsbeatProperties,\n AttachStatsbeatProperties,\n StatsbeatFeatureType,\n StatsbeatOptions,\n} from \"./types\";\nimport { AzureMonitorStatsbeatExporter } from \"./statsbeatExporter\";\n\nlet instance: LongIntervalStatsbeatMetrics | null = null;\n\n/**\n * Long Interval Statsbeat Metrics\n * @internal\n */\nclass LongIntervalStatsbeatMetrics extends StatsbeatMetrics {\n private AZURE_MONITOR_STATSBEAT_FEATURES = process.env.AZURE_MONITOR_STATSBEAT_FEATURES;\n private statsCollectionLongInterval: number = 86400000; // 1 day\n // Custom dimensions\n private cikey: string;\n private runtimeVersion: string;\n private language: string;\n private version: string;\n private attach: string = \"Manual\";\n\n private commonProperties: CommonStatsbeatProperties;\n private attachProperties: AttachStatsbeatProperties;\n\n private feature: number = 0;\n private instrumentation: number = 0;\n\n private longIntervalStatsbeatMeterProvider: MeterProvider;\n private longIntervalAzureExporter: AzureMonitorStatsbeatExporter;\n private longIntervalMetricReader: PeriodicExportingMetricReader;\n private longIntervalStatsbeatMeter: Meter;\n\n // Network Attributes\n private connectionString: string;\n\n // Observable Gauges\n private featureStatsbeatGauge: ObservableGauge;\n private attachStatsbeatGauge: ObservableGauge;\n\n public isInitialized: boolean = false;\n\n constructor(options: StatsbeatOptions) {\n super();\n this.connectionString = super.getConnectionString(options.endpointUrl);\n const exporterConfig: AzureMonitorExporterOptions = {\n connectionString: this.connectionString,\n };\n\n if (this.AZURE_MONITOR_STATSBEAT_FEATURES) {\n try {\n this.feature = JSON.parse(this.AZURE_MONITOR_STATSBEAT_FEATURES).feature;\n this.instrumentation = JSON.parse(this.AZURE_MONITOR_STATSBEAT_FEATURES).instrumentation;\n } catch (error: any) {\n diag.error(\n `LongIntervalStatsbeat: Failed to parse features/instrumentations (error ${error})`,\n );\n }\n }\n\n this.longIntervalStatsbeatMeterProvider = new MeterProvider();\n this.longIntervalAzureExporter = new AzureMonitorStatsbeatExporter(exporterConfig);\n\n // Export Long Interval Statsbeats every day\n const longIntervalMetricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.longIntervalAzureExporter,\n exportIntervalMillis:\n Number(process.env.LONG_INTERVAL_EXPORT_MILLIS) || this.statsCollectionLongInterval, // 1 day\n };\n\n this.longIntervalMetricReader = new PeriodicExportingMetricReader(\n longIntervalMetricReaderOptions,\n );\n this.longIntervalStatsbeatMeterProvider.addMetricReader(this.longIntervalMetricReader);\n this.longIntervalStatsbeatMeter = this.longIntervalStatsbeatMeterProvider.getMeter(\n \"Azure Monitor Long Interval Statsbeat\",\n );\n\n // Assign Common Properties\n this.runtimeVersion = process.version;\n this.language = STATSBEAT_LANGUAGE;\n this.version = ai.packageVersion;\n this.cikey = options.instrumentationKey;\n\n this.featureStatsbeatGauge = this.longIntervalStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.FEATURE,\n );\n this.attachStatsbeatGauge = this.longIntervalStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.ATTACH,\n );\n\n this.commonProperties = {\n os: super.os,\n rp: super.resourceProvider,\n cikey: this.cikey,\n runtimeVersion: this.runtimeVersion,\n language: this.language,\n version: this.version,\n attach: this.attach,\n };\n\n this.attachProperties = {\n rpId: super.resourceIdentifier,\n };\n\n this.isInitialized = true;\n this.initialize();\n }\n\n private async initialize() {\n try {\n await this.getResourceProvider();\n\n // Add long interval observable callbacks\n this.attachStatsbeatGauge.addCallback(this.attachCallback.bind(this));\n this.longIntervalStatsbeatMeter.addBatchObservableCallback(this.featureCallback.bind(this), [\n this.featureStatsbeatGauge,\n ]);\n\n // Export Feature/Attach Statsbeat once upon app initialization\n this.longIntervalAzureExporter.export(\n (await this.longIntervalMetricReader.collect()).resourceMetrics,\n (result: ExportResult) => {\n if (result.code !== ExportResultCode.SUCCESS) {\n diag.error(`LongIntervalStatsbeat: metrics export failed (error ${result.error})`);\n }\n },\n );\n } catch (error) {\n diag.debug(\"Call to get the resource provider failed.\");\n }\n }\n\n private featureCallback(observableResult: BatchObservableResult) {\n let attributes;\n if (this.instrumentation) {\n attributes = {\n ...this.commonProperties,\n feature: this.instrumentation,\n type: StatsbeatFeatureType.INSTRUMENTATION,\n };\n observableResult.observe(this.featureStatsbeatGauge, 1, { ...attributes });\n }\n\n if (this.feature) {\n attributes = {\n ...this.commonProperties,\n feature: this.feature,\n type: StatsbeatFeatureType.FEATURE,\n };\n observableResult.observe(this.featureStatsbeatGauge, 1, { ...attributes });\n }\n }\n\n private attachCallback(observableResult: ObservableResult) {\n const attributes = { ...this.commonProperties, ...this.attachProperties };\n observableResult.observe(1, attributes);\n }\n\n public shutdown(): Promise<void> {\n return this.longIntervalStatsbeatMeterProvider.shutdown();\n }\n}\n\n/**\n * Singleton LongIntervalStatsbeatMetrics instance.\n * @internal\n */\nexport function getInstance(options: StatsbeatOptions): LongIntervalStatsbeatMetrics {\n if (!instance) {\n instance = new LongIntervalStatsbeatMetrics(options);\n }\n return instance;\n}\n"]}
@@ -12,7 +12,7 @@ export class NetworkStatsbeatMetrics extends StatsbeatMetrics {
12
12
  this.isInitialized = false;
13
13
  this.statsCollectionShortInterval = 900000; // 15 minutes
14
14
  this.networkStatsbeatCollection = [];
15
- this.attach = "sdk";
15
+ this.attach = "Manual";
16
16
  this.connectionString = super.getConnectionString(options.endpointUrl);
17
17
  this.networkStatsbeatMeterProvider = new MeterProvider();
18
18
  const exporterConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"networkStatsbeatMetrics.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/networkStatsbeatMetrics.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,IAAI,GAKL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,6BAA6B,GAE9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAgC3D,YAAY,OAAyB;QACnC,KAAK,EAAE,CAAC;QA9BF,kBAAa,GAAY,KAAK,CAAC;QAC/B,iCAA4B,GAAW,MAAM,CAAC,CAAC,aAAa;QAE5D,+BAA0B,GAA4B,EAAE,CAAC;QAWzD,WAAM,GAAW,KAAK,CAAC;QAiB7B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC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ED,uEAAuE;IAC/D,0BAA0B,CAAC,QAAgB,EAAE,IAAY;QAC/D,oCAAoC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/D,cAAc;YACd,IACE,QAAQ,KAAK,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,QAAQ;gBACxD,IAAI,KAAK,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,IAAI,EAChD;gBACA,OAAO,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;aAC3C;SACF;QACD,oCAAoC;QACpC,MAAM,UAAU,GAAG,IAAI,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACxD,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,YAAY,CAAC,YAAoB;QACvC,IAAI,SAAS,GAAG,YAAY,CAAC;QAC7B,IAAI;YACF,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,kCAAkC,CAAC,CAAC;YACjE,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;aACpB;YACD,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;SACxE;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;SAClD;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n diag,\n BatchObservableResult,\n Meter,\n ObservableGauge,\n ObservableResult,\n} from \"@opentelemetry/api\";\nimport {\n MeterProvider,\n PeriodicExportingMetricReader,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { AzureMonitorExporterOptions } from \"../../index\";\nimport * as ai from \"../../utils/constants/applicationinsights\";\nimport { StatsbeatMetrics } from \"./statsbeatMetrics\";\nimport {\n StatsbeatCounter,\n STATSBEAT_LANGUAGE,\n NetworkStatsbeat,\n CommonStatsbeatProperties,\n NetworkStatsbeatProperties,\n StatsbeatOptions,\n} from \"./types\";\nimport { AzureMonitorStatsbeatExporter } from \"./statsbeatExporter\";\n\nexport class NetworkStatsbeatMetrics extends StatsbeatMetrics {\n private commonProperties: CommonStatsbeatProperties;\n private networkProperties: NetworkStatsbeatProperties;\n private isInitialized: boolean = false;\n private statsCollectionShortInterval: number = 900000; // 15 minutes\n\n private networkStatsbeatCollection: Array<NetworkStatsbeat> = [];\n private networkStatsbeatMeter: Meter;\n private networkStatsbeatMeterProvider: MeterProvider;\n private networkAzureExporter: AzureMonitorStatsbeatExporter;\n private networkMetricReader: PeriodicExportingMetricReader;\n\n // Custom dimensions\n private cikey: string;\n private runtimeVersion: string;\n private language: string;\n private version: string;\n private attach: string = \"sdk\";\n\n // Observable Gauges\n private successCountGauge: ObservableGauge;\n private failureCountGauge: ObservableGauge;\n private retryCountGauge: ObservableGauge;\n private throttleCountGauge: ObservableGauge;\n private exceptionCountGauge: ObservableGauge;\n private averageDurationGauge: ObservableGauge;\n\n // Network attributes\n private connectionString: string;\n private endpointUrl: string;\n private host: string;\n\n constructor(options: StatsbeatOptions) {\n super();\n this.connectionString = super.getConnectionString(options.endpointUrl);\n this.networkStatsbeatMeterProvider = new MeterProvider();\n\n const exporterConfig: AzureMonitorExporterOptions = {\n connectionString: this.connectionString,\n };\n\n this.networkAzureExporter = new AzureMonitorStatsbeatExporter(exporterConfig);\n\n // Exports Network Statsbeat every 15 minutes\n const networkMetricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.networkAzureExporter,\n exportIntervalMillis: options.networkCollectionInterval || this.statsCollectionShortInterval, // 15 minutes\n };\n\n this.networkMetricReader = new PeriodicExportingMetricReader(networkMetricReaderOptions);\n this.networkStatsbeatMeterProvider.addMetricReader(this.networkMetricReader);\n this.networkStatsbeatMeter = this.networkStatsbeatMeterProvider.getMeter(\n \"Azure Monitor Network Statsbeat\"\n );\n\n this.endpointUrl = options.endpointUrl;\n this.runtimeVersion = process.version;\n this.language = STATSBEAT_LANGUAGE;\n this.version = ai.packageVersion;\n this.host = this.getShortHost(options.endpointUrl);\n this.cikey = options.instrumentationKey;\n\n this.successCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.SUCCESS_COUNT\n );\n this.failureCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.FAILURE_COUNT\n );\n this.retryCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.RETRY_COUNT\n );\n this.throttleCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.THROTTLE_COUNT\n );\n this.exceptionCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.EXCEPTION_COUNT\n );\n this.averageDurationGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.AVERAGE_DURATION\n );\n\n this.commonProperties = {\n os: super.os,\n rp: super.resourceProvider,\n cikey: this.cikey,\n runtimeVersion: this.runtimeVersion,\n language: this.language,\n version: this.version,\n attach: this.attach,\n };\n\n this.networkProperties = {\n endpoint: this.endpointUrl,\n host: this.host,\n };\n\n this.isInitialized = true;\n this.initialize();\n }\n\n public shutdown(): Promise<void> {\n return this.networkStatsbeatMeterProvider.shutdown();\n }\n\n private async initialize(): Promise<void> {\n try {\n await super.getResourceProvider();\n\n // Add network observable callbacks\n this.successCountGauge.addCallback(this.successCallback.bind(this));\n this.networkStatsbeatMeter.addBatchObservableCallback(this.failureCallback.bind(this), [\n this.failureCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.retryCallback.bind(this), [\n this.retryCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.throttleCallback.bind(this), [\n this.throttleCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.exceptionCallback.bind(this), [\n this.exceptionCountGauge,\n ]);\n this.averageDurationGauge.addCallback(this.durationCallback.bind(this));\n } catch (error) {\n diag.debug(\"Call to get the resource provider failed.\");\n }\n }\n\n // Observable gauge callbacks\n private successCallback(observableResult: ObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.commonProperties, ...this.networkProperties };\n observableResult.observe(counter.totalSuccesfulRequestCount, attributes);\n counter.totalSuccesfulRequestCount = 0;\n }\n\n private failureCallback(observableResult: BatchObservableResult) {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n\n /*\n Takes the failureCountGauge, value (of the counter), and attributes\n create a unqiue counter based on statusCode as well\n append statusCode to attributes so the newly created attributes are unique.\n */\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n // For each { statusCode -> count } mapping, call observe, passing the count and attributes that include the statusCode\n for (let i = 0; i < counter.totalFailedRequestCount.length; i++) {\n attributes.statusCode = counter.totalFailedRequestCount[i].statusCode;\n observableResult.observe(this.failureCountGauge, counter.totalFailedRequestCount[i].count, {\n ...attributes,\n });\n counter.totalFailedRequestCount[i].count = 0;\n }\n }\n\n private retryCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n for (let i = 0; i < counter.retryCount.length; i++) {\n attributes.statusCode = counter.retryCount[i].statusCode;\n observableResult.observe(this.retryCountGauge, counter.retryCount[i].count, {\n ...attributes,\n });\n counter.retryCount[i].count = 0;\n }\n }\n\n private throttleCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n for (let i = 0; i < counter.throttleCount.length; i++) {\n attributes.statusCode = counter.throttleCount[i].statusCode;\n observableResult.observe(this.throttleCountGauge, counter.throttleCount[i].count, {\n ...attributes,\n });\n counter.throttleCount[i].count = 0;\n }\n }\n\n private exceptionCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, exceptionType: \"\" };\n\n for (let i = 0; i < counter.exceptionCount.length; i++) {\n attributes.exceptionType = counter.exceptionCount[i].exceptionType;\n observableResult.observe(this.exceptionCountGauge, counter.exceptionCount[i].count, {\n ...attributes,\n });\n counter.exceptionCount[i].count = 0;\n }\n }\n\n private durationCallback(observableResult: ObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties };\n for (let i = 0; i < this.networkStatsbeatCollection.length; i++) {\n const currentCounter = this.networkStatsbeatCollection[i];\n currentCounter.time = Number(new Date());\n const intervalRequests =\n currentCounter.totalRequestCount - currentCounter.lastRequestCount || 0;\n currentCounter.averageRequestExecutionTime =\n (currentCounter.intervalRequestExecutionTime -\n currentCounter.lastIntervalRequestExecutionTime) /\n intervalRequests || 0;\n currentCounter.lastIntervalRequestExecutionTime = currentCounter.intervalRequestExecutionTime; // reset\n\n currentCounter.lastRequestCount = currentCounter.totalRequestCount;\n currentCounter.lastTime = currentCounter.time;\n }\n observableResult.observe(counter.averageRequestExecutionTime, attributes);\n\n counter.averageRequestExecutionTime = 0;\n }\n\n // Public methods to increase counters\n public countSuccess(duration: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n counter.totalRequestCount++;\n counter.totalSuccesfulRequestCount++;\n counter.intervalRequestExecutionTime += duration;\n }\n\n public countFailure(duration: number, statusCode: number) {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.totalFailedRequestCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.totalFailedRequestCount.push({ statusCode: statusCode, count: 1 });\n }\n\n counter.totalRequestCount++;\n counter.intervalRequestExecutionTime += duration;\n }\n\n public countRetry(statusCode: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.retryCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.retryCount.push({ statusCode: statusCode, count: 1 });\n }\n }\n\n public countThrottle(statusCode: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.throttleCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.throttleCount.push({ statusCode: statusCode, count: 1 });\n }\n }\n\n public countException(exceptionType: Error): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentErrorCounter = counter.exceptionCount.find(\n (exceptionCounter) => exceptionType.name === exceptionCounter.exceptionType\n );\n if (currentErrorCounter) {\n currentErrorCounter.count++;\n } else {\n counter.exceptionCount.push({ exceptionType: exceptionType.name, count: 1 });\n }\n }\n\n // Gets a networkStatsbeat counter if one exists for the given endpoint\n private getNetworkStatsbeatCounter(endpoint: string, host: string): NetworkStatsbeat {\n // Check if the counter is available\n for (let i = 0; i < this.networkStatsbeatCollection.length; i++) {\n // Same object\n if (\n endpoint === this.networkStatsbeatCollection[i].endpoint &&\n host === this.networkStatsbeatCollection[i].host\n ) {\n return this.networkStatsbeatCollection[i];\n }\n }\n // Create a new counter if not found\n const newCounter = new NetworkStatsbeat(endpoint, host);\n this.networkStatsbeatCollection.push(newCounter);\n return newCounter;\n }\n\n private getShortHost(originalHost: string): string {\n let shortHost = originalHost;\n try {\n const hostRegex = new RegExp(/^https?:\\/\\/(?:www\\.)?([^\\/.-]+)/);\n const res = hostRegex.exec(originalHost);\n if (res !== null && res.length > 1) {\n shortHost = res[1];\n }\n shortHost = shortHost.replace(\".in.applicationinsights.azure.com\", \"\");\n } catch (error) {\n diag.debug(\"Failed to get the short host name.\");\n }\n return shortHost;\n }\n}\n"]}
1
+ {"version":3,"file":"networkStatsbeatMetrics.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/networkStatsbeatMetrics.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,IAAI,GAKL,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,6BAA6B,GAE9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAgC3D,YAAY,OAAyB;QACnC,KAAK,EAAE,CAAC;QA9BF,kBAAa,GAAY,KAAK,CAAC;QAC/B,iCAA4B,GAAW,MAAM,CAAC,CAAC,aAAa;QAE5D,+BAA0B,GAA4B,EAAE,CAAC;QAWzD,WAAM,GAAW,QAAQ,CAAC;QAi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Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n diag,\n BatchObservableResult,\n Meter,\n ObservableGauge,\n ObservableResult,\n} from \"@opentelemetry/api\";\nimport {\n MeterProvider,\n PeriodicExportingMetricReader,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { AzureMonitorExporterOptions } from \"../../index\";\nimport * as ai from \"../../utils/constants/applicationinsights\";\nimport { StatsbeatMetrics } from \"./statsbeatMetrics\";\nimport {\n StatsbeatCounter,\n STATSBEAT_LANGUAGE,\n NetworkStatsbeat,\n CommonStatsbeatProperties,\n NetworkStatsbeatProperties,\n StatsbeatOptions,\n} from \"./types\";\nimport { AzureMonitorStatsbeatExporter } from \"./statsbeatExporter\";\n\nexport class NetworkStatsbeatMetrics extends StatsbeatMetrics {\n private commonProperties: CommonStatsbeatProperties;\n private networkProperties: NetworkStatsbeatProperties;\n private isInitialized: boolean = false;\n private statsCollectionShortInterval: number = 900000; // 15 minutes\n\n private networkStatsbeatCollection: Array<NetworkStatsbeat> = [];\n private networkStatsbeatMeter: Meter;\n private networkStatsbeatMeterProvider: MeterProvider;\n private networkAzureExporter: AzureMonitorStatsbeatExporter;\n private networkMetricReader: PeriodicExportingMetricReader;\n\n // Custom dimensions\n private cikey: string;\n private runtimeVersion: string;\n private language: string;\n private version: string;\n private attach: string = \"Manual\";\n\n // Observable Gauges\n private successCountGauge: ObservableGauge;\n private failureCountGauge: ObservableGauge;\n private retryCountGauge: ObservableGauge;\n private throttleCountGauge: ObservableGauge;\n private exceptionCountGauge: ObservableGauge;\n private averageDurationGauge: ObservableGauge;\n\n // Network attributes\n private connectionString: string;\n private endpointUrl: string;\n private host: string;\n\n constructor(options: StatsbeatOptions) {\n super();\n this.connectionString = super.getConnectionString(options.endpointUrl);\n this.networkStatsbeatMeterProvider = new MeterProvider();\n\n const exporterConfig: AzureMonitorExporterOptions = {\n connectionString: this.connectionString,\n };\n\n this.networkAzureExporter = new AzureMonitorStatsbeatExporter(exporterConfig);\n\n // Exports Network Statsbeat every 15 minutes\n const networkMetricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.networkAzureExporter,\n exportIntervalMillis: options.networkCollectionInterval || this.statsCollectionShortInterval, // 15 minutes\n };\n\n this.networkMetricReader = new PeriodicExportingMetricReader(networkMetricReaderOptions);\n this.networkStatsbeatMeterProvider.addMetricReader(this.networkMetricReader);\n this.networkStatsbeatMeter = this.networkStatsbeatMeterProvider.getMeter(\n \"Azure Monitor Network Statsbeat\",\n );\n\n this.endpointUrl = options.endpointUrl;\n this.runtimeVersion = process.version;\n this.language = STATSBEAT_LANGUAGE;\n this.version = ai.packageVersion;\n this.host = this.getShortHost(options.endpointUrl);\n this.cikey = options.instrumentationKey;\n\n this.successCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.SUCCESS_COUNT,\n );\n this.failureCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.FAILURE_COUNT,\n );\n this.retryCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.RETRY_COUNT,\n );\n this.throttleCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.THROTTLE_COUNT,\n );\n this.exceptionCountGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.EXCEPTION_COUNT,\n );\n this.averageDurationGauge = this.networkStatsbeatMeter.createObservableGauge(\n StatsbeatCounter.AVERAGE_DURATION,\n );\n\n this.commonProperties = {\n os: super.os,\n rp: super.resourceProvider,\n cikey: this.cikey,\n runtimeVersion: this.runtimeVersion,\n language: this.language,\n version: this.version,\n attach: this.attach,\n };\n\n this.networkProperties = {\n endpoint: this.endpointUrl,\n host: this.host,\n };\n\n this.isInitialized = true;\n this.initialize();\n }\n\n public shutdown(): Promise<void> {\n return this.networkStatsbeatMeterProvider.shutdown();\n }\n\n private async initialize(): Promise<void> {\n try {\n await super.getResourceProvider();\n\n // Add network observable callbacks\n this.successCountGauge.addCallback(this.successCallback.bind(this));\n this.networkStatsbeatMeter.addBatchObservableCallback(this.failureCallback.bind(this), [\n this.failureCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.retryCallback.bind(this), [\n this.retryCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.throttleCallback.bind(this), [\n this.throttleCountGauge,\n ]);\n this.networkStatsbeatMeter.addBatchObservableCallback(this.exceptionCallback.bind(this), [\n this.exceptionCountGauge,\n ]);\n this.averageDurationGauge.addCallback(this.durationCallback.bind(this));\n } catch (error) {\n diag.debug(\"Call to get the resource provider failed.\");\n }\n }\n\n // Observable gauge callbacks\n private successCallback(observableResult: ObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.commonProperties, ...this.networkProperties };\n observableResult.observe(counter.totalSuccesfulRequestCount, attributes);\n counter.totalSuccesfulRequestCount = 0;\n }\n\n private failureCallback(observableResult: BatchObservableResult) {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n\n /*\n Takes the failureCountGauge, value (of the counter), and attributes\n create a unqiue counter based on statusCode as well\n append statusCode to attributes so the newly created attributes are unique.\n */\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n // For each { statusCode -> count } mapping, call observe, passing the count and attributes that include the statusCode\n for (let i = 0; i < counter.totalFailedRequestCount.length; i++) {\n attributes.statusCode = counter.totalFailedRequestCount[i].statusCode;\n observableResult.observe(this.failureCountGauge, counter.totalFailedRequestCount[i].count, {\n ...attributes,\n });\n counter.totalFailedRequestCount[i].count = 0;\n }\n }\n\n private retryCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n for (let i = 0; i < counter.retryCount.length; i++) {\n attributes.statusCode = counter.retryCount[i].statusCode;\n observableResult.observe(this.retryCountGauge, counter.retryCount[i].count, {\n ...attributes,\n });\n counter.retryCount[i].count = 0;\n }\n }\n\n private throttleCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, statusCode: 0 };\n\n for (let i = 0; i < counter.throttleCount.length; i++) {\n attributes.statusCode = counter.throttleCount[i].statusCode;\n observableResult.observe(this.throttleCountGauge, counter.throttleCount[i].count, {\n ...attributes,\n });\n counter.throttleCount[i].count = 0;\n }\n }\n\n private exceptionCallback(observableResult: BatchObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties, exceptionType: \"\" };\n\n for (let i = 0; i < counter.exceptionCount.length; i++) {\n attributes.exceptionType = counter.exceptionCount[i].exceptionType;\n observableResult.observe(this.exceptionCountGauge, counter.exceptionCount[i].count, {\n ...attributes,\n });\n counter.exceptionCount[i].count = 0;\n }\n }\n\n private durationCallback(observableResult: ObservableResult): void {\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const attributes = { ...this.networkProperties, ...this.commonProperties };\n for (let i = 0; i < this.networkStatsbeatCollection.length; i++) {\n const currentCounter = this.networkStatsbeatCollection[i];\n currentCounter.time = Number(new Date());\n const intervalRequests =\n currentCounter.totalRequestCount - currentCounter.lastRequestCount || 0;\n currentCounter.averageRequestExecutionTime =\n (currentCounter.intervalRequestExecutionTime -\n currentCounter.lastIntervalRequestExecutionTime) /\n intervalRequests || 0;\n currentCounter.lastIntervalRequestExecutionTime = currentCounter.intervalRequestExecutionTime; // reset\n\n currentCounter.lastRequestCount = currentCounter.totalRequestCount;\n currentCounter.lastTime = currentCounter.time;\n }\n observableResult.observe(counter.averageRequestExecutionTime, attributes);\n\n counter.averageRequestExecutionTime = 0;\n }\n\n // Public methods to increase counters\n public countSuccess(duration: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n counter.totalRequestCount++;\n counter.totalSuccesfulRequestCount++;\n counter.intervalRequestExecutionTime += duration;\n }\n\n public countFailure(duration: number, statusCode: number) {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.totalFailedRequestCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode,\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.totalFailedRequestCount.push({ statusCode: statusCode, count: 1 });\n }\n\n counter.totalRequestCount++;\n counter.intervalRequestExecutionTime += duration;\n }\n\n public countRetry(statusCode: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.retryCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode,\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.retryCount.push({ statusCode: statusCode, count: 1 });\n }\n }\n\n public countThrottle(statusCode: number): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentStatusCounter = counter.throttleCount.find(\n (statusCounter) => statusCode === statusCounter.statusCode,\n );\n\n if (currentStatusCounter) {\n currentStatusCounter.count++;\n } else {\n counter.throttleCount.push({ statusCode: statusCode, count: 1 });\n }\n }\n\n public countException(exceptionType: Error): void {\n if (!this.isInitialized) {\n return;\n }\n const counter: NetworkStatsbeat = this.getNetworkStatsbeatCounter(this.endpointUrl, this.host);\n const currentErrorCounter = counter.exceptionCount.find(\n (exceptionCounter) => exceptionType.name === exceptionCounter.exceptionType,\n );\n if (currentErrorCounter) {\n currentErrorCounter.count++;\n } else {\n counter.exceptionCount.push({ exceptionType: exceptionType.name, count: 1 });\n }\n }\n\n // Gets a networkStatsbeat counter if one exists for the given endpoint\n private getNetworkStatsbeatCounter(endpoint: string, host: string): NetworkStatsbeat {\n // Check if the counter is available\n for (let i = 0; i < this.networkStatsbeatCollection.length; i++) {\n // Same object\n if (\n endpoint === this.networkStatsbeatCollection[i].endpoint &&\n host === this.networkStatsbeatCollection[i].host\n ) {\n return this.networkStatsbeatCollection[i];\n }\n }\n // Create a new counter if not found\n const newCounter = new NetworkStatsbeat(endpoint, host);\n this.networkStatsbeatCollection.push(newCounter);\n return newCounter;\n }\n\n private getShortHost(originalHost: string): string {\n let shortHost = originalHost;\n try {\n const hostRegex = new RegExp(/^https?:\\/\\/(?:www\\.)?([^\\/.-]+)/);\n const res = hostRegex.exec(originalHost);\n if (res !== null && res.length > 1) {\n shortHost = res[1];\n }\n shortHost = shortHost.replace(\".in.applicationinsights.azure.com\", \"\");\n } catch (error) {\n diag.debug(\"Failed to get the short host name.\");\n }\n return shortHost;\n }\n}\n"]}
@@ -34,8 +34,7 @@ export class AzureMonitorStatsbeatExporter extends AzureMonitorBaseExporter {
34
34
  setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);
35
35
  return;
36
36
  }
37
- const envelopes = resourceMetricsToEnvelope(metrics, this.instrumentationKey, true // isStatsbeat flag passed to create a Statsbeat envelope.
38
- );
37
+ const envelopes = resourceMetricsToEnvelope(metrics, this.instrumentationKey, true);
39
38
  // Supress tracing until OpenTelemetry Metrics SDK support it
40
39
  context.with(suppressTracing(context.active()), async () => {
41
40
  resultCallback(await this._sender.exportEnvelopes(envelopes));
@@ -1 +1 @@
1
- {"version":3,"file":"statsbeatExporter.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/statsbeatExporter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CA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,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context } from \"@opentelemetry/api\";\nimport { PushMetricExporter, ResourceMetrics } from \"@opentelemetry/sdk-metrics\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorExporterOptions } from \"../../config\";\nimport { TelemetryItem as Envelope } from \"../../generated\";\nimport { resourceMetricsToEnvelope } from \"../../utils/metricUtils\";\nimport { AzureMonitorBaseExporter } from \"../base\";\nimport { HttpSender } from \"../../platform\";\n\n/**\n * Azure Monitor Statsbeat Exporter\n */\nexport class AzureMonitorStatsbeatExporter\n extends AzureMonitorBaseExporter\n implements PushMetricExporter\n{\n /**\n * Flag to determine if the Exporter is shutdown.\n */\n private _isShutdown = false;\n private _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorStatsbeatExporter class.\n * @param options - Exporter configuration\n */\n constructor(options: AzureMonitorExporterOptions) {\n super(options, true);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n });\n }\n\n /**\n * Export Statsbeat metrics.\n */\n async export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void\n ): Promise<void> {\n if (this._isShutdown) {\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n\n const envelopes: Envelope[] = resourceMetricsToEnvelope(\n metrics,\n this.instrumentationKey,\n true // isStatsbeat flag passed to create a Statsbeat envelope.\n );\n // Supress tracing until OpenTelemetry Metrics SDK support it\n context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorStatsbeatExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n return this._sender.shutdown();\n }\n\n /**\n * Force flush.\n */\n public async forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n"]}
1
+ {"version":3,"file":"statsbeatExporter.js","sourceRoot":"","sources":["../../../../src/export/statsbeat/statsbeatExporter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAgB,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,6BACX,SAAQ,wBAAwB;IAShC;;;OAGG;IACH,YAAY,OAAoC;QAC9C,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAXvB;;WAEG;QACK,gBAAW,GAAG,KAAK,CAAC;QAS1B,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC;YAC5B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,OAAO;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAAwB,EACxB,cAA8C;QAE9C,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,UAAU,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACvE,OAAO;SACR;QAED,MAAM,SAAS,GAAe,yBAAyB,CACrD,OAAO,EACP,IAAI,CAAC,kBAAkB,EACvB,IAAI,CACL,CAAC;QACF,6DAA6D;QAC7D,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,IAAI,EAAE;YACzD,cAAc,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { context } from \"@opentelemetry/api\";\nimport { PushMetricExporter, ResourceMetrics } from \"@opentelemetry/sdk-metrics\";\nimport { ExportResult, ExportResultCode, suppressTracing } from \"@opentelemetry/core\";\nimport { AzureMonitorExporterOptions } from \"../../config\";\nimport { TelemetryItem as Envelope } from \"../../generated\";\nimport { resourceMetricsToEnvelope } from \"../../utils/metricUtils\";\nimport { AzureMonitorBaseExporter } from \"../base\";\nimport { HttpSender } from \"../../platform\";\n\n/**\n * Azure Monitor Statsbeat Exporter\n */\nexport class AzureMonitorStatsbeatExporter\n extends AzureMonitorBaseExporter\n implements PushMetricExporter\n{\n /**\n * Flag to determine if the Exporter is shutdown.\n */\n private _isShutdown = false;\n private _sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorStatsbeatExporter class.\n * @param options - Exporter configuration\n */\n constructor(options: AzureMonitorExporterOptions) {\n super(options, true);\n this._sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n });\n }\n\n /**\n * Export Statsbeat metrics.\n */\n async export(\n metrics: ResourceMetrics,\n resultCallback: (result: ExportResult) => void,\n ): Promise<void> {\n if (this._isShutdown) {\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n\n const envelopes: Envelope[] = resourceMetricsToEnvelope(\n metrics,\n this.instrumentationKey,\n true, // isStatsbeat flag passed to create a Statsbeat envelope.\n );\n // Supress tracing until OpenTelemetry Metrics SDK support it\n context.with(suppressTracing(context.active()), async () => {\n resultCallback(await this._sender.exportEnvelopes(envelopes));\n });\n }\n\n /**\n * Shutdown AzureMonitorStatsbeatExporter.\n */\n public async shutdown(): Promise<void> {\n this._isShutdown = true;\n return this._sender.shutdown();\n }\n\n /**\n * Force flush.\n */\n public async forceFlush(): Promise<void> {\n return Promise.resolve();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/export/trace.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IAOrE;;;OAGG;IACH,YAAY,UAAuC,EAAE;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAXjB;;WAEG;QACK,eAAU,GAAG,KAAK,CAAC;QASzB,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YA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AC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;SAC9D;QACD,oBAAoB;QACpB,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { diag } from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode } from \"@opentelemetry/core\";\nimport { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { AzureMonitorExporterOptions } from \"../config\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { readableSpanToEnvelope, spanEventsToEnvelopes } from \"../utils/spanUtils\";\nimport { createResourceMetricEnvelope } from \"../utils/common\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Exporter.\n */\nexport class AzureMonitorTraceExporter extends AzureMonitorBaseExporter implements SpanExporter {\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private isShutdown = false;\n private readonly sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorTraceExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this.sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorTraceExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry spans.\n * @param spans - Spans to export.\n * @param resultCallback - Result callback.\n */\n async export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): Promise<void> {\n if (this.isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n\n diag.info(`Exporting ${spans.length} span(s). Converting to envelopes...`);\n\n if (spans.length > 0) {\n const envelopes: Envelope[] = [];\n const resourceMetricEnvelope = createResourceMetricEnvelope(\n spans[0].resource,\n this.instrumentationKey\n );\n if (resourceMetricEnvelope) {\n envelopes.push(resourceMetricEnvelope);\n }\n spans.forEach((span) => {\n envelopes.push(readableSpanToEnvelope(span, this.instrumentationKey));\n const spanEventEnvelopes = spanEventsToEnvelopes(span, this.instrumentationKey);\n if (spanEventEnvelopes.length > 0) {\n envelopes.push(...spanEventEnvelopes);\n }\n });\n resultCallback(await this.sender.exportEnvelopes(envelopes));\n }\n // No data to export\n resultCallback({ code: ExportResultCode.SUCCESS });\n }\n\n /**\n * Shutdown AzureMonitorTraceExporter.\n */\n async shutdown(): Promise<void> {\n this.isShutdown = true;\n diag.info(\"AzureMonitorTraceExporter shutting down\");\n return this.sender.shutdown();\n }\n}\n"]}
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/export/trace.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IAOrE;;;OAGG;IACH,YAAY,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,CAAC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBAChF,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjC,SAAS,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,CAAC;iBACvC;YACH,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;SAC9D;QACD,oBAAoB;QACpB,cAAc,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { diag } from \"@opentelemetry/api\";\nimport { ExportResult, ExportResultCode } from \"@opentelemetry/core\";\nimport { ReadableSpan, SpanExporter } from \"@opentelemetry/sdk-trace-base\";\nimport { AzureMonitorBaseExporter } from \"./base\";\nimport { AzureMonitorExporterOptions } from \"../config\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { readableSpanToEnvelope, spanEventsToEnvelopes } from \"../utils/spanUtils\";\nimport { createResourceMetricEnvelope } from \"../utils/common\";\nimport { HttpSender } from \"../platform\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Exporter.\n */\nexport class AzureMonitorTraceExporter extends AzureMonitorBaseExporter implements SpanExporter {\n /**\n * Flag to determine if Exporter is shutdown.\n */\n private isShutdown = false;\n private readonly sender: HttpSender;\n\n /**\n * Initializes a new instance of the AzureMonitorTraceExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n constructor(options: AzureMonitorExporterOptions = {}) {\n super(options);\n this.sender = new HttpSender({\n endpointUrl: this.endpointUrl,\n instrumentationKey: this.instrumentationKey,\n trackStatsbeat: this.trackStatsbeat,\n exporterOptions: options,\n aadAudience: this.aadAudience,\n });\n diag.debug(\"AzureMonitorTraceExporter was successfully setup\");\n }\n\n /**\n * Export OpenTelemetry spans.\n * @param spans - Spans to export.\n * @param resultCallback - Result callback.\n */\n async export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void,\n ): Promise<void> {\n if (this.isShutdown) {\n diag.info(\"Exporter shut down. Failed to export spans.\");\n setTimeout(() => resultCallback({ code: ExportResultCode.FAILED }), 0);\n return;\n }\n\n diag.info(`Exporting ${spans.length} span(s). Converting to envelopes...`);\n\n if (spans.length > 0) {\n const envelopes: Envelope[] = [];\n const resourceMetricEnvelope = createResourceMetricEnvelope(\n spans[0].resource,\n this.instrumentationKey,\n );\n if (resourceMetricEnvelope) {\n envelopes.push(resourceMetricEnvelope);\n }\n spans.forEach((span) => {\n envelopes.push(readableSpanToEnvelope(span, this.instrumentationKey));\n const spanEventEnvelopes = spanEventsToEnvelopes(span, this.instrumentationKey);\n if (spanEventEnvelopes.length > 0) {\n envelopes.push(...spanEventEnvelopes);\n }\n });\n resultCallback(await this.sender.exportEnvelopes(envelopes));\n }\n // No data to export\n resultCallback({ code: ExportResultCode.SUCCESS });\n }\n\n /**\n * Shutdown AzureMonitorTraceExporter.\n */\n async shutdown(): Promise<void> {\n this.isShutdown = true;\n diag.info(\"AzureMonitorTraceExporter shutting down\");\n return this.sender.shutdown();\n }\n}\n"]}
@@ -6,7 +6,6 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
  import * as coreClient from "@azure/core-client";
9
- import * as coreRestPipeline from "@azure/core-rest-pipeline";
10
9
  import * as Parameters from "./models/parameters";
11
10
  import * as Mappers from "./models/mappers";
12
11
  export class ApplicationInsightsClient extends coreClient.ServiceClient {
@@ -21,32 +20,16 @@ export class ApplicationInsightsClient extends coreClient.ServiceClient {
21
20
  options = {};
22
21
  }
23
22
  const defaults = {
24
- requestContentType: "application/json; charset=utf-8"
23
+ requestContentType: "application/json; charset=utf-8",
25
24
  };
26
- const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.18`;
25
+ const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.19`;
27
26
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
28
27
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
29
28
  : `${packageDetails}`;
30
29
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
31
- userAgentPrefix
32
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Host}/v2.1" });
30
+ userAgentPrefix,
31
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Host}/v2.1" });
33
32
  super(optionsWithDefaults);
34
- if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
35
- const pipelinePolicies = options.pipeline.getOrderedPolicies();
36
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
37
- coreRestPipeline.bearerTokenAuthenticationPolicyName);
38
- if (!bearerTokenAuthenticationPolicyFound) {
39
- this.pipeline.removePolicy({
40
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
41
- });
42
- this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
43
- scopes: `${optionsWithDefaults.baseUri}/.default`,
44
- challengeCallbacks: {
45
- authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
46
- }
47
- }));
48
- }
49
- }
50
33
  // Assigning values to Constant parameters
51
34
  this.host = options.host || "https://dc.services.visualstudio.com";
52
35
  }
@@ -66,36 +49,36 @@ const trackOperationSpec = {
66
49
  httpMethod: "POST",
67
50
  responses: {
68
51
  200: {
69
- bodyMapper: Mappers.TrackResponse
52
+ bodyMapper: Mappers.TrackResponse,
70
53
  },
71
54
  206: {
72
- bodyMapper: Mappers.TrackResponse
55
+ bodyMapper: Mappers.TrackResponse,
73
56
  },
74
57
  400: {
75
58
  bodyMapper: Mappers.TrackResponse,
76
- isError: true
59
+ isError: true,
77
60
  },
78
61
  402: {
79
62
  bodyMapper: Mappers.TrackResponse,
80
- isError: true
63
+ isError: true,
81
64
  },
82
65
  429: {
83
66
  bodyMapper: Mappers.TrackResponse,
84
- isError: true
67
+ isError: true,
85
68
  },
86
69
  500: {
87
70
  bodyMapper: Mappers.TrackResponse,
88
- isError: true
71
+ isError: true,
89
72
  },
90
73
  503: {
91
74
  bodyMapper: Mappers.TrackResponse,
92
- isError: true
93
- }
75
+ isError: true,
76
+ },
94
77
  },
95
78
  requestBody: Parameters.body,
96
79
  urlParameters: [Parameters.host],
97
80
  headerParameters: [Parameters.contentType, Parameters.accept],
98
81
  mediaType: "json",
99
- serializer
82
+ serializer,
100
83
  };
101
84
  //# sourceMappingURL=applicationInsightsClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"applicationInsightsClient.js","sourceRoot":"","sources":["../../../src/generated/applicationInsightsClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAQ5C,MAAM,OAAO,yBAA0B,SAAQ,UAAU,CAAC,aAAa;IAGrE;;;OAGG;IACH,YAAY,OAAiD;;QAC3D,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAA4C;YACxD,kBAAkB,EAAE,iCAAiC;SACtD,CA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G,OAAO,CAAC,IAAI,IAAI,sCAAsC,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACH,KAAK,CACH,IAAqB,EACrB,OAA6B;QAE7B,OAAO,IAAI,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAC1E,CAAC;CACF;AACD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAE3E,MAAM,kBAAkB,GAA6B;IACnD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;KACF;IACD,WAAW,EAAE,UAAU,CAAC,IAAI;IAC5B,aAAa,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;IAChC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport {\n ApplicationInsightsClientOptionalParams,\n TelemetryItem,\n TrackOptionalParams,\n TrackOperationResponse\n} from \"./models\";\n\nexport class ApplicationInsightsClient extends coreClient.ServiceClient {\n host: string;\n\n /**\n * Initializes a new instance of the ApplicationInsightsClient class.\n * @param options The parameter options\n */\n constructor(options?: ApplicationInsightsClientOptionalParams) {\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: ApplicationInsightsClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.18`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n baseUri: options.endpoint ?? options.baseUri ?? \"{Host}/v2.1\"\n };\n super(optionsWithDefaults);\n\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n if (!bearerTokenAuthenticationPolicyFound) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n scopes: `${optionsWithDefaults.baseUri}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n }\n\n // Assigning values to Constant parameters\n this.host = options.host || \"https://dc.services.visualstudio.com\";\n }\n\n /**\n * This operation sends a sequence of telemetry events that will be monitored by Azure Monitor.\n * @param body The list of telemetry events to track.\n * @param options The options parameters.\n */\n track(\n body: TelemetryItem[],\n options?: TrackOptionalParams\n ): Promise<TrackOperationResponse> {\n return this.sendOperationRequest({ body, options }, trackOperationSpec);\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst trackOperationSpec: coreClient.OperationSpec = {\n path: \"/track\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.TrackResponse\n },\n 206: {\n bodyMapper: Mappers.TrackResponse\n },\n 400: {\n bodyMapper: Mappers.TrackResponse,\n isError: true\n },\n 402: {\n bodyMapper: Mappers.TrackResponse,\n isError: true\n },\n 429: {\n bodyMapper: Mappers.TrackResponse,\n isError: true\n },\n 500: {\n bodyMapper: Mappers.TrackResponse,\n isError: true\n },\n 503: {\n bodyMapper: Mappers.TrackResponse,\n isError: true\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\n"]}
1
+ {"version":3,"file":"applicationInsightsClient.js","sourceRoot":"","sources":["../../../src/generated/applicationInsightsClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAQ5C,MAAM,OAAO,yBAA0B,SAAQ,UAAU,CAAC,aAAa;IAGrE;;;OAGG;IACH,YAAY,OAAiD;;QAC3D,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAA4C;YACxD,kBAAkB,EAAE,iCAAiC;SACtD,C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AAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;QACD,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI;SACd;KACF;IACD,WAAW,EAAE,UAAU,CAAC,IAAI;IAC5B,aAAa,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;IAChC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,MAAM;IACjB,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport {\n ApplicationInsightsClientOptionalParams,\n TelemetryItem,\n TrackOptionalParams,\n TrackOperationResponse,\n} from \"./models\";\n\nexport class ApplicationInsightsClient extends coreClient.ServiceClient {\n host: string;\n\n /**\n * Initializes a new instance of the ApplicationInsightsClient class.\n * @param options The parameter options\n */\n constructor(options?: ApplicationInsightsClientOptionalParams) {\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: ApplicationInsightsClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n };\n\n const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.19`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{Host}/v2.1\",\n };\n super(optionsWithDefaults);\n\n // Assigning values to Constant parameters\n this.host = options.host || \"https://dc.services.visualstudio.com\";\n }\n\n /**\n * This operation sends a sequence of telemetry events that will be monitored by Azure Monitor.\n * @param body The list of telemetry events to track.\n * @param options The options parameters.\n */\n track(\n body: TelemetryItem[],\n options?: TrackOptionalParams,\n ): Promise<TrackOperationResponse> {\n return this.sendOperationRequest({ body, options }, trackOperationSpec);\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst trackOperationSpec: coreClient.OperationSpec = {\n path: \"/track\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.TrackResponse,\n },\n 206: {\n bodyMapper: Mappers.TrackResponse,\n },\n 400: {\n bodyMapper: Mappers.TrackResponse,\n isError: true,\n },\n 402: {\n bodyMapper: Mappers.TrackResponse,\n isError: true,\n },\n 429: {\n bodyMapper: Mappers.TrackResponse,\n isError: true,\n },\n 500: {\n bodyMapper: Mappers.TrackResponse,\n isError: true,\n },\n 503: {\n bodyMapper: Mappers.TrackResponse,\n isError: true,\n },\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyQH,sEAAsE;AACtE,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,iDAA2B,CAAA;IAC3B,kBAAkB;IAClB,iDAA2B,CAAA;AAC7B,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAYD,sEAAsE;AACtE,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,cAAc;IACd,yCAAmB,CAAA;IACnB,kBAAkB;IAClB,iDAA2B,CAAA;IAC3B,cAAc;IACd,yCAAmB,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ourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** System variables for a telemetry item. */\nexport interface TelemetryItem {\n /** Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1. */\n version?: number;\n /** Type name of telemetry data item. */\n name: string;\n /** Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. */\n time: Date;\n /** Sampling rate used in application. This telemetry item represents 100 / sampleRate actual telemetry items. */\n sampleRate?: number;\n /** Sequence field used to track absolute order of uploaded events. */\n sequence?: string;\n /** The instrumentation key of the Application Insights resource. */\n instrumentationKey?: string;\n /** Key/value collection of context properties. See ContextTagKeys for information on available properties. */\n tags?: { [propertyName: string]: string };\n /** Telemetry data item. */\n data?: MonitorBase;\n}\n\n/** Data struct to contain only C section with custom fields. */\nexport interface MonitorBase {\n /** Name of item (B section) if any. If telemetry data is derived straight from this, this should be null. */\n baseType?: string;\n /** The data payload for the telemetry request */\n baseData?: MonitorDomain;\n}\n\n/** The abstract common base of all domains. */\nexport interface MonitorDomain {\n /** Describes unknown properties. The value of an unknown property can be of \"any\" type. */\n [property: string]: any;\n /** Schema version */\n version: number;\n}\n\n/** Response containing the status of each telemetry item. */\nexport interface TrackResponse {\n /** The number of items received. */\n itemsReceived?: number;\n /** The number of items accepted. */\n itemsAccepted?: number;\n /** An array of error detail objects. */\n errors?: TelemetryErrorDetails[];\n}\n\n/** The error details */\nexport interface TelemetryErrorDetails {\n /** The index in the original payload of the item. */\n index?: number;\n /** The item specific [HTTP Response status code](#Response Status Codes). */\n statusCode?: number;\n /** The error message. */\n message?: string;\n}\n\n/** Metric data single measurement. */\nexport interface MetricDataPoint {\n /** Namespace of the metric. */\n namespace?: string;\n /** Name of the metric. */\n name: string;\n /** Metric type. Single measurement or the aggregated value. */\n dataPointType?: DataPointType;\n /** Single value for measurement. Sum of individual measurements for the aggregation. */\n value: number;\n /** Metric weight of the aggregated metric. Should not be set for a measurement. */\n count?: number;\n /** Minimum value of the aggregated metric. Should not be set for a measurement. */\n min?: number;\n /** Maximum value of the aggregated metric. Should not be set for a measurement. */\n max?: number;\n /** Standard deviation of the aggregated metric. Should not be set for a measurement. */\n stdDev?: number;\n}\n\n/** Exception details of the exception in a chain. */\nexport interface TelemetryExceptionDetails {\n /** In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting. */\n id?: number;\n /** The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception */\n outerId?: number;\n /** Exception type name. */\n typeName?: string;\n /** Exception message. */\n message: string;\n /** Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception. */\n hasFullStack?: boolean;\n /** Text describing the stack. Either stack or parsedStack should have a value. */\n stack?: string;\n /** List of stack frames. Either stack or parsedStack should have a value. */\n parsedStack?: StackFrame[];\n}\n\n/** Stack frame information. */\nexport interface StackFrame {\n level: number;\n /** Method name. */\n method: string;\n /** Name of the assembly (dll, jar, etc.) containing this function. */\n assembly?: string;\n /** File name or URL of the method implementation. */\n fileName?: string;\n /** Line number of the code implementation. */\n line?: number;\n}\n\n/** Instances of AvailabilityData represent the result of executing an availability test. */\nexport interface AvailabilityData extends MonitorDomain {\n /** Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service. */\n id: string;\n /** Name of the test that these availability results represent. */\n name: string;\n /** Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Success flag. */\n success: boolean;\n /** Name of the location where the test was run from. */\n runLocation?: string;\n /** Diagnostic message for the result. */\n message?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name. */\nexport interface TelemetryEventData extends MonitorDomain {\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application. */\nexport interface TelemetryExceptionData extends MonitorDomain {\n /** Exception chain - list of inner exceptions. */\n exceptions: TelemetryExceptionDetails[];\n /** Severity level. Mostly used to indicate exception severity level when it is reported by logging library. */\n severityLevel?: SeverityLevel;\n /** Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack. */\n problemId?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into instances of this type. The message does not have measurements. */\nexport interface MessageData extends MonitorDomain {\n /** Trace message */\n message: string;\n /** Trace severity level. */\n severityLevel?: SeverityLevel;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of the Metric item is a list of measurements (single data points) and/or aggregations. */\nexport interface MetricsData extends MonitorDomain {\n /** List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used. */\n metrics: MetricDataPoint[];\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n}\n\n/** An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView. */\nexport interface PageViewData extends MonitorDomain {\n /** Identifier of a page view instance. Used for correlation between page view and other telemetry items. */\n id: string;\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Request URL with all query string parameters */\n url?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. */\n duration?: string;\n /** Fully qualified page URI or URL of the referring page; if unknown, leave blank */\n referredUri?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request. */\nexport interface PageViewPerfData extends MonitorDomain {\n /** Identifier of a page view instance. Used for correlation between page view and other telemetry items. */\n id: string;\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Request URL with all query string parameters */\n url?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. */\n duration?: string;\n /** Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n perfTotal?: string;\n /** Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n networkConnect?: string;\n /** Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n sentRequest?: string;\n /** Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n receivedResponse?: string;\n /** DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n domProcessing?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint. */\nexport interface RemoteDependencyData extends MonitorDomain {\n /** Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call. */\n id?: string;\n /** Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. */\n name: string;\n /** Result code of a dependency call. Examples are SQL error code and HTTP status code. */\n resultCode?: string;\n /** Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters. */\n data?: string;\n /** Dependency type name. Very low cardinality value for logical grouping of dependencies and interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP. */\n type?: string;\n /** Target site of a dependency call. Examples are server name, host address. */\n target?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Indication of successful or unsuccessful call. */\n success?: boolean;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Request represents completion of an external request to the application to do work and contains a summary of that request execution and the results. */\nexport interface RequestData extends MonitorDomain {\n /** Identifier of a request call instance. Used for correlation between request and other telemetry items. */\n id: string;\n /** Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'. */\n name?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Indication of successful or unsuccessful call. */\n success: boolean;\n /** Result of a request execution. HTTP status code for HTTP requests. */\n responseCode: string;\n /** Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller. */\n source?: string;\n /** Request URL with all query string parameters. */\n url?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Known values of {@link DataPointType} that the service accepts. */\nexport enum KnownDataPointType {\n /** Measurement */\n Measurement = \"Measurement\",\n /** Aggregation */\n Aggregation = \"Aggregation\"\n}\n\n/**\n * Defines values for DataPointType. \\\n * {@link KnownDataPointType} can be used interchangeably with DataPointType,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **Measurement** \\\n * **Aggregation**\n */\nexport type DataPointType = string;\n\n/** Known values of {@link SeverityLevel} that the service accepts. */\nexport enum KnownSeverityLevel {\n /** Verbose */\n Verbose = \"Verbose\",\n /** Information */\n Information = \"Information\",\n /** Warning */\n Warning = \"Warning\",\n /** Error */\n Error = \"Error\",\n /** Critical */\n Critical = \"Critical\"\n}\n\n/**\n * Defines values for SeverityLevel. \\\n * {@link KnownSeverityLevel} can be used interchangeably with SeverityLevel,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **Verbose** \\\n * **Information** \\\n * **Warning** \\\n * **Error** \\\n * **Critical**\n */\nexport type SeverityLevel = string;\n\n/** Known values of {@link ContextTagKeys} that the service accepts. */\nexport enum KnownContextTagKeys {\n /** AiApplicationVer */\n AiApplicationVer = \"ai.application.ver\",\n /** AiDeviceId */\n AiDeviceId = \"ai.device.id\",\n /** AiDeviceLocale */\n AiDeviceLocale = \"ai.device.locale\",\n /** AiDeviceModel */\n AiDeviceModel = \"ai.device.model\",\n /** AiDeviceOemName */\n AiDeviceOemName = \"ai.device.oemName\",\n /** AiDeviceOsVersion */\n AiDeviceOsVersion = \"ai.device.osVersion\",\n /** AiDeviceType */\n AiDeviceType = \"ai.device.type\",\n /** AiLocationIp */\n AiLocationIp = \"ai.location.ip\",\n /** AiLocationCountry */\n AiLocationCountry = \"ai.location.country\",\n /** AiLocationProvince */\n AiLocationProvince = \"ai.location.province\",\n /** AiLocationCity */\n AiLocationCity = \"ai.location.city\",\n /** AiOperationId */\n AiOperationId = \"ai.operation.id\",\n /** AiOperationName */\n AiOperationName = \"ai.operation.name\",\n /** AiOperationParentId */\n AiOperationParentId = \"ai.operation.parentId\",\n /** AiOperationSyntheticSource */\n AiOperationSyntheticSource = \"ai.operation.syntheticSource\",\n /** AiOperationCorrelationVector */\n AiOperationCorrelationVector = \"ai.operation.correlationVector\",\n /** AiSessionId */\n AiSessionId = \"ai.session.id\",\n /** AiSessionIsFirst */\n AiSessionIsFirst = \"ai.session.isFirst\",\n /** AiUserAccountId */\n AiUserAccountId = \"ai.user.accountId\",\n /** AiUserId */\n AiUserId = \"ai.user.id\",\n /** AiUserAuthUserId */\n AiUserAuthUserId = \"ai.user.authUserId\",\n /** AiCloudRole */\n AiCloudRole = \"ai.cloud.role\",\n /** AiCloudRoleVer */\n AiCloudRoleVer = \"ai.cloud.roleVer\",\n /** AiCloudRoleInstance */\n AiCloudRoleInstance = \"ai.cloud.roleInstance\",\n /** AiCloudLocation */\n AiCloudLocation = \"ai.cloud.location\",\n /** AiInternalSdkVersion */\n AiInternalSdkVersion = \"ai.internal.sdkVersion\",\n /** AiInternalAgentVersion */\n AiInternalAgentVersion = \"ai.internal.agentVersion\",\n /** AiInternalNodeName */\n AiInternalNodeName = \"ai.internal.nodeName\"\n}\n\n/**\n * Defines values for ContextTagKeys. \\\n * {@link KnownContextTagKeys} can be used interchangeably with ContextTagKeys,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **ai.application.ver** \\\n * **ai.device.id** \\\n * **ai.device.locale** \\\n * **ai.device.model** \\\n * **ai.device.oemName** \\\n * **ai.device.osVersion** \\\n * **ai.device.type** \\\n * **ai.location.ip** \\\n * **ai.location.country** \\\n * **ai.location.province** \\\n * **ai.location.city** \\\n * **ai.operation.id** \\\n * **ai.operation.name** \\\n * **ai.operation.parentId** \\\n * **ai.operation.syntheticSource** \\\n * **ai.operation.correlationVector** \\\n * **ai.session.id** \\\n * **ai.session.isFirst** \\\n * **ai.user.accountId** \\\n * **ai.user.id** \\\n * **ai.user.authUserId** \\\n * **ai.cloud.role** \\\n * **ai.cloud.roleVer** \\\n * **ai.cloud.roleInstance** \\\n * **ai.cloud.location** \\\n * **ai.internal.sdkVersion** \\\n * **ai.internal.agentVersion** \\\n * **ai.internal.nodeName**\n */\nexport type ContextTagKeys = string;\n\n/** Optional parameters. */\nexport interface TrackOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the track operation. */\nexport type TrackOperationResponse = TrackResponse;\n\n/** Optional parameters. */\nexport interface ApplicationInsightsClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Breeze endpoint: https://dc.services.visualstudio.com */\n host?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyQH,sEAAsE;AACtE,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,kBAAkB;IAClB,iDAA2B,CAAA;IAC3B,kBAAkB;IAClB,iDAA2B,CAAA;AAC7B,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAYD,sEAAsE;AACtE,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,cAAc;IACd,yCAAmB,CAAA;IACnB,kBAAkB;IAClB,iDAA2B,CAAA;IAC3B,cAAc;IACd,yCAAmB,CAAA;IACnB,YAAY;IACZ,qCAAe,CAAA;IACf,eAAe;IACf,2CAAqB,CAAA;AACvB,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAeD,uEAAuE;AACvE,MAAM,CAAN,IAAY,mBAyDX;AAzDD,WAAY,mBAAmB;IAC7B,uBAAuB;IACvB,8DAAuC,CAAA;IACvC,iBAAiB;IACjB,kDAA2B,CAAA;IAC3B,qBAAqB;IACrB,0DAAmC,CAAA;IACnC,oBAAoB;IACpB,wDAAiC,CAAA;IACjC,sBAAsB;IACtB,4DAAqC,CAAA;IACrC,wBAAwB;IACxB,gEAAyC,CAAA;IACzC,mBAAmB;IACnB,sDAA+B,CAAA;IAC/B,mBAAmB;IACnB,sDAA+B,CAAA;IAC/B,wBAAwB;IACxB,gEAAyC,CAAA;IACzC,yBAAyB;IACzB,kEAA2C,CAAA;IAC3C,qBAAqB;IACrB,0DAAmC,CAAA;IACnC,oBAAoB;IACpB,wDAAiC,CAAA;IACjC,sBAAsB;IACtB,4DAAqC,CAAA;IACrC,0BAA0B;IAC1B,oEAA6C,CAAA;IAC7C,iCAAiC;IACjC,kFAA2D,CAAA;IAC3D,mCAAmC;IACnC,sFAA+D,CAAA;IAC/D,kBAAkB;IAClB,oDAA6B,CAAA;IAC7B,uBAAuB;IACvB,8DAAuC,CAAA;IACvC,sBAAsB;IACtB,4DAAqC,CAAA;IACrC,eAAe;IACf,8CAAuB,CAAA;IACvB,uBAAuB;IACvB,8DAAuC,CAAA;IACvC,kBAAkB;IAClB,oDAA6B,CAAA;IAC7B,qBAAqB;IACrB,0DAAmC,CAAA;IACnC,0BAA0B;IAC1B,oEAA6C,CAAA;IAC7C,sBAAsB;IACtB,4DAAqC,CAAA;IACrC,2BAA2B;IAC3B,sEAA+C,CAAA;IAC/C,6BAA6B;IAC7B,0EAAmD,CAAA;IACnD,yBAAyB;IACzB,kEAA2C,CAAA;AAC7C,CAAC,EAzDW,mBAAmB,KAAnB,mBAAmB,QAyD9B","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** System variables for a telemetry item. */\nexport interface TelemetryItem {\n /** Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1. */\n version?: number;\n /** Type name of telemetry data item. */\n name: string;\n /** Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. */\n time: Date;\n /** Sampling rate used in application. This telemetry item represents 100 / sampleRate actual telemetry items. */\n sampleRate?: number;\n /** Sequence field used to track absolute order of uploaded events. */\n sequence?: string;\n /** The instrumentation key of the Application Insights resource. */\n instrumentationKey?: string;\n /** Key/value collection of context properties. See ContextTagKeys for information on available properties. */\n tags?: { [propertyName: string]: string };\n /** Telemetry data item. */\n data?: MonitorBase;\n}\n\n/** Data struct to contain only C section with custom fields. */\nexport interface MonitorBase {\n /** Name of item (B section) if any. If telemetry data is derived straight from this, this should be null. */\n baseType?: string;\n /** The data payload for the telemetry request */\n baseData?: MonitorDomain;\n}\n\n/** The abstract common base of all domains. */\nexport interface MonitorDomain {\n /** Describes unknown properties. The value of an unknown property can be of \"any\" type. */\n [property: string]: any;\n /** Schema version */\n version: number;\n}\n\n/** Response containing the status of each telemetry item. */\nexport interface TrackResponse {\n /** The number of items received. */\n itemsReceived?: number;\n /** The number of items accepted. */\n itemsAccepted?: number;\n /** An array of error detail objects. */\n errors?: TelemetryErrorDetails[];\n}\n\n/** The error details */\nexport interface TelemetryErrorDetails {\n /** The index in the original payload of the item. */\n index?: number;\n /** The item specific [HTTP Response status code](#Response Status Codes). */\n statusCode?: number;\n /** The error message. */\n message?: string;\n}\n\n/** Metric data single measurement. */\nexport interface MetricDataPoint {\n /** Namespace of the metric. */\n namespace?: string;\n /** Name of the metric. */\n name: string;\n /** Metric type. Single measurement or the aggregated value. */\n dataPointType?: DataPointType;\n /** Single value for measurement. Sum of individual measurements for the aggregation. */\n value: number;\n /** Metric weight of the aggregated metric. Should not be set for a measurement. */\n count?: number;\n /** Minimum value of the aggregated metric. Should not be set for a measurement. */\n min?: number;\n /** Maximum value of the aggregated metric. Should not be set for a measurement. */\n max?: number;\n /** Standard deviation of the aggregated metric. Should not be set for a measurement. */\n stdDev?: number;\n}\n\n/** Exception details of the exception in a chain. */\nexport interface TelemetryExceptionDetails {\n /** In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting. */\n id?: number;\n /** The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception */\n outerId?: number;\n /** Exception type name. */\n typeName?: string;\n /** Exception message. */\n message: string;\n /** Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception. */\n hasFullStack?: boolean;\n /** Text describing the stack. Either stack or parsedStack should have a value. */\n stack?: string;\n /** List of stack frames. Either stack or parsedStack should have a value. */\n parsedStack?: StackFrame[];\n}\n\n/** Stack frame information. */\nexport interface StackFrame {\n level: number;\n /** Method name. */\n method: string;\n /** Name of the assembly (dll, jar, etc.) containing this function. */\n assembly?: string;\n /** File name or URL of the method implementation. */\n fileName?: string;\n /** Line number of the code implementation. */\n line?: number;\n}\n\n/** Instances of AvailabilityData represent the result of executing an availability test. */\nexport interface AvailabilityData extends MonitorDomain {\n /** Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service. */\n id: string;\n /** Name of the test that these availability results represent. */\n name: string;\n /** Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Success flag. */\n success: boolean;\n /** Name of the location where the test was run from. */\n runLocation?: string;\n /** Diagnostic message for the result. */\n message?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name. */\nexport interface TelemetryEventData extends MonitorDomain {\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application. */\nexport interface TelemetryExceptionData extends MonitorDomain {\n /** Exception chain - list of inner exceptions. */\n exceptions: TelemetryExceptionDetails[];\n /** Severity level. Mostly used to indicate exception severity level when it is reported by logging library. */\n severityLevel?: SeverityLevel;\n /** Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack. */\n problemId?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into instances of this type. The message does not have measurements. */\nexport interface MessageData extends MonitorDomain {\n /** Trace message */\n message: string;\n /** Trace severity level. */\n severityLevel?: SeverityLevel;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of the Metric item is a list of measurements (single data points) and/or aggregations. */\nexport interface MetricsData extends MonitorDomain {\n /** List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used. */\n metrics: MetricDataPoint[];\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n}\n\n/** An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView. */\nexport interface PageViewData extends MonitorDomain {\n /** Identifier of a page view instance. Used for correlation between page view and other telemetry items. */\n id: string;\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Request URL with all query string parameters */\n url?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. */\n duration?: string;\n /** Fully qualified page URI or URL of the referring page; if unknown, leave blank */\n referredUri?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request. */\nexport interface PageViewPerfData extends MonitorDomain {\n /** Identifier of a page view instance. Used for correlation between page view and other telemetry items. */\n id: string;\n /** Event name. Keep it low cardinality to allow proper grouping and useful metrics. */\n name: string;\n /** Request URL with all query string parameters */\n url?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days. */\n duration?: string;\n /** Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n perfTotal?: string;\n /** Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n networkConnect?: string;\n /** Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n sentRequest?: string;\n /** Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n receivedResponse?: string;\n /** DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff */\n domProcessing?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint. */\nexport interface RemoteDependencyData extends MonitorDomain {\n /** Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call. */\n id?: string;\n /** Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template. */\n name: string;\n /** Result code of a dependency call. Examples are SQL error code and HTTP status code. */\n resultCode?: string;\n /** Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters. */\n data?: string;\n /** Dependency type name. Very low cardinality value for logical grouping of dependencies and interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP. */\n type?: string;\n /** Target site of a dependency call. Examples are server name, host address. */\n target?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Indication of successful or unsuccessful call. */\n success?: boolean;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** An instance of Request represents completion of an external request to the application to do work and contains a summary of that request execution and the results. */\nexport interface RequestData extends MonitorDomain {\n /** Identifier of a request call instance. Used for correlation between request and other telemetry items. */\n id: string;\n /** Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'. */\n name?: string;\n /** Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. */\n duration: string;\n /** Indication of successful or unsuccessful call. */\n success: boolean;\n /** Result of a request execution. HTTP status code for HTTP requests. */\n responseCode: string;\n /** Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller. */\n source?: string;\n /** Request URL with all query string parameters. */\n url?: string;\n /** Collection of custom properties. */\n properties?: { [propertyName: string]: string };\n /** Collection of custom measurements. */\n measurements?: { [propertyName: string]: number };\n}\n\n/** Known values of {@link DataPointType} that the service accepts. */\nexport enum KnownDataPointType {\n /** Measurement */\n Measurement = \"Measurement\",\n /** Aggregation */\n Aggregation = \"Aggregation\",\n}\n\n/**\n * Defines values for DataPointType. \\\n * {@link KnownDataPointType} can be used interchangeably with DataPointType,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **Measurement** \\\n * **Aggregation**\n */\nexport type DataPointType = string;\n\n/** Known values of {@link SeverityLevel} that the service accepts. */\nexport enum KnownSeverityLevel {\n /** Verbose */\n Verbose = \"Verbose\",\n /** Information */\n Information = \"Information\",\n /** Warning */\n Warning = \"Warning\",\n /** Error */\n Error = \"Error\",\n /** Critical */\n Critical = \"Critical\",\n}\n\n/**\n * Defines values for SeverityLevel. \\\n * {@link KnownSeverityLevel} can be used interchangeably with SeverityLevel,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **Verbose** \\\n * **Information** \\\n * **Warning** \\\n * **Error** \\\n * **Critical**\n */\nexport type SeverityLevel = string;\n\n/** Known values of {@link ContextTagKeys} that the service accepts. */\nexport enum KnownContextTagKeys {\n /** AiApplicationVer */\n AiApplicationVer = \"ai.application.ver\",\n /** AiDeviceId */\n AiDeviceId = \"ai.device.id\",\n /** AiDeviceLocale */\n AiDeviceLocale = \"ai.device.locale\",\n /** AiDeviceModel */\n AiDeviceModel = \"ai.device.model\",\n /** AiDeviceOemName */\n AiDeviceOemName = \"ai.device.oemName\",\n /** AiDeviceOsVersion */\n AiDeviceOsVersion = \"ai.device.osVersion\",\n /** AiDeviceType */\n AiDeviceType = \"ai.device.type\",\n /** AiLocationIp */\n AiLocationIp = \"ai.location.ip\",\n /** AiLocationCountry */\n AiLocationCountry = \"ai.location.country\",\n /** AiLocationProvince */\n AiLocationProvince = \"ai.location.province\",\n /** AiLocationCity */\n AiLocationCity = \"ai.location.city\",\n /** AiOperationId */\n AiOperationId = \"ai.operation.id\",\n /** AiOperationName */\n AiOperationName = \"ai.operation.name\",\n /** AiOperationParentId */\n AiOperationParentId = \"ai.operation.parentId\",\n /** AiOperationSyntheticSource */\n AiOperationSyntheticSource = \"ai.operation.syntheticSource\",\n /** AiOperationCorrelationVector */\n AiOperationCorrelationVector = \"ai.operation.correlationVector\",\n /** AiSessionId */\n AiSessionId = \"ai.session.id\",\n /** AiSessionIsFirst */\n AiSessionIsFirst = \"ai.session.isFirst\",\n /** AiUserAccountId */\n AiUserAccountId = \"ai.user.accountId\",\n /** AiUserId */\n AiUserId = \"ai.user.id\",\n /** AiUserAuthUserId */\n AiUserAuthUserId = \"ai.user.authUserId\",\n /** AiCloudRole */\n AiCloudRole = \"ai.cloud.role\",\n /** AiCloudRoleVer */\n AiCloudRoleVer = \"ai.cloud.roleVer\",\n /** AiCloudRoleInstance */\n AiCloudRoleInstance = \"ai.cloud.roleInstance\",\n /** AiCloudLocation */\n AiCloudLocation = \"ai.cloud.location\",\n /** AiInternalSdkVersion */\n AiInternalSdkVersion = \"ai.internal.sdkVersion\",\n /** AiInternalAgentVersion */\n AiInternalAgentVersion = \"ai.internal.agentVersion\",\n /** AiInternalNodeName */\n AiInternalNodeName = \"ai.internal.nodeName\",\n}\n\n/**\n * Defines values for ContextTagKeys. \\\n * {@link KnownContextTagKeys} can be used interchangeably with ContextTagKeys,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **ai.application.ver** \\\n * **ai.device.id** \\\n * **ai.device.locale** \\\n * **ai.device.model** \\\n * **ai.device.oemName** \\\n * **ai.device.osVersion** \\\n * **ai.device.type** \\\n * **ai.location.ip** \\\n * **ai.location.country** \\\n * **ai.location.province** \\\n * **ai.location.city** \\\n * **ai.operation.id** \\\n * **ai.operation.name** \\\n * **ai.operation.parentId** \\\n * **ai.operation.syntheticSource** \\\n * **ai.operation.correlationVector** \\\n * **ai.session.id** \\\n * **ai.session.isFirst** \\\n * **ai.user.accountId** \\\n * **ai.user.id** \\\n * **ai.user.authUserId** \\\n * **ai.cloud.role** \\\n * **ai.cloud.roleVer** \\\n * **ai.cloud.roleInstance** \\\n * **ai.cloud.location** \\\n * **ai.internal.sdkVersion** \\\n * **ai.internal.agentVersion** \\\n * **ai.internal.nodeName**\n */\nexport type ContextTagKeys = string;\n\n/** Optional parameters. */\nexport interface TrackOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the track operation. */\nexport type TrackOperationResponse = TrackResponse;\n\n/** Optional parameters. */\nexport interface ApplicationInsightsClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Breeze endpoint: https://dc.services.visualstudio.com */\n host?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}