@azure/monitor-opentelemetry-exporter 1.0.0-beta.4 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +11 -13
- package/dist/index.js +701 -355
- package/dist-esm/src/Declarations/Constants.js +1 -26
- package/dist-esm/src/Declarations/Constants.js.map +1 -1
- package/dist-esm/src/config.js +2 -4
- package/dist-esm/src/config.js.map +1 -1
- package/dist-esm/src/export/trace.js +5 -4
- package/dist-esm/src/export/trace.js.map +1 -1
- package/dist-esm/src/generated/applicationInsightsClient.js +13 -9
- package/dist-esm/src/generated/applicationInsightsClient.js.map +1 -1
- package/dist-esm/src/generated/applicationInsightsClientContext.js +13 -11
- package/dist-esm/src/generated/applicationInsightsClientContext.js.map +1 -1
- package/dist-esm/src/generated/models/index.js +47 -1
- package/dist-esm/src/generated/models/index.js.map +1 -1
- package/dist-esm/src/generated/models/mappers.js +25 -4
- package/dist-esm/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/src/generated/models/parameters.js +6 -1
- package/dist-esm/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/src/platform/nodejs/constants.js +1 -1
- package/dist-esm/src/platform/nodejs/constants.js.map +1 -1
- package/dist-esm/src/platform/nodejs/context/context.js +12 -82
- package/dist-esm/src/platform/nodejs/context/context.js.map +1 -1
- package/dist-esm/src/platform/nodejs/httpSender.js +23 -4
- package/dist-esm/src/platform/nodejs/httpSender.js.map +1 -1
- package/dist-esm/src/platform/nodejs/persist/fileAccessControl.js +171 -0
- package/dist-esm/src/platform/nodejs/persist/fileAccessControl.js.map +1 -0
- package/dist-esm/src/platform/nodejs/persist/fileSystemPersist.js +40 -19
- package/dist-esm/src/platform/nodejs/persist/fileSystemPersist.js.map +1 -1
- package/dist-esm/src/types.js.map +1 -1
- package/dist-esm/src/utils/breezeUtils.js +5 -4
- package/dist-esm/src/utils/breezeUtils.js.map +1 -1
- package/dist-esm/src/utils/constants/applicationinsights.js +9 -31
- package/dist-esm/src/utils/constants/applicationinsights.js.map +1 -1
- package/dist-esm/src/utils/eventhub.js +1 -1
- package/dist-esm/src/utils/eventhub.js.map +1 -1
- package/dist-esm/src/utils/spanUtils.js +253 -100
- package/dist-esm/src/utils/spanUtils.js.map +1 -1
- package/package.json +37 -24
- package/types/monitor-opentelemetry-exporter.d.ts +7 -2
- package/dist-esm/src/utils/constants/span/dbAttributes.js +0 -14
- package/dist-esm/src/utils/constants/span/dbAttributes.js.map +0 -1
- package/dist-esm/src/utils/constants/span/grpcAttributes.js +0 -14
- package/dist-esm/src/utils/constants/span/grpcAttributes.js.map +0 -1
- package/dist-esm/src/utils/constants/span/httpAttributes.js +0 -24
- package/dist-esm/src/utils/constants/span/httpAttributes.js.map +0 -1
|
@@ -91,31 +91,6 @@ export const PerformanceToQuickPulseCounter = {
|
|
|
91
91
|
[QuickPulseCounter.DEPENDENCY_RATE]: QuickPulseCounter.DEPENDENCY_RATE,
|
|
92
92
|
[QuickPulseCounter.DEPENDENCY_FAILURE_RATE]: QuickPulseCounter.DEPENDENCY_FAILURE_RATE,
|
|
93
93
|
[QuickPulseCounter.DEPENDENCY_DURATION]: QuickPulseCounter.DEPENDENCY_DURATION,
|
|
94
|
-
[QuickPulseCounter.EXCEPTION_RATE]: QuickPulseCounter.EXCEPTION_RATE
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* OpenTelemetry Span Attributes.
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
export const SpanAttribute = {
|
|
101
|
-
// HTTP
|
|
102
|
-
HttpHost: "http.host",
|
|
103
|
-
HttpMethod: "http.method",
|
|
104
|
-
HttpPort: "http.port",
|
|
105
|
-
HttpStatusCode: "http.status_code",
|
|
106
|
-
HttpUrl: "http.url",
|
|
107
|
-
HttpUserAgent: "http.user_agent",
|
|
108
|
-
// GRPC
|
|
109
|
-
GrpcMethod: "grpc.method",
|
|
110
|
-
GrpcService: "rpc.service" // rpc not grpc
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* OpenTelemetry dependency type names.
|
|
114
|
-
* @internal
|
|
115
|
-
*/
|
|
116
|
-
export const DependencyTypeName = {
|
|
117
|
-
Grpc: "GRPC",
|
|
118
|
-
Http: "HTTP",
|
|
119
|
-
InProc: "InProc"
|
|
94
|
+
[QuickPulseCounter.EXCEPTION_RATE]: QuickPulseCounter.EXCEPTION_RATE,
|
|
120
95
|
};
|
|
121
96
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/Declarations/Constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,8CAAyB,CAAA;AAC3B,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,sCAAsC,CAAC;AAC9E;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC,EAAE,CAAC;AAC/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,sCAAsC,CAAC;AACnF;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AACvE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,uCAAuC,CAAC;AAC7E;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAmBX;AAnBD,WAAY,iBAAiB;IAC3B,SAAS;IACT,kEAA6C,CAAA;IAE7C,MAAM;IACN,6EAAwD,CAAA;IAExD,UAAU;IACV,yEAAoD,CAAA;IACpD,wFAAmE,CAAA;IACnE,iFAA4D,CAAA;IA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AA8B,GAAyC;IAClF,CAAC,kBAAkB,CAAC,cAAc,CAAC,EAAE,iBAAiB,CAAC,cAAc;IACrE,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,YAAY;IACjE,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,gBAAgB;IAEzE,kCAAkC;IAClC,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC,eAAe;IACtE,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAAE,iBAAiB,CAAC,oBAAoB;IAChF,CAAC,iBAAiB,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC,eAAe;IACtE,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,iBAAiB,CAAC,uBAAuB;IACtF,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,EAAE,iBAAiB,CAAC,mBAAmB;IAC9E,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,iBAAiB,CAAC,cAAc;CACrE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Azure service API version.\n */\nexport enum ServiceApiVersion {\n /**\n * V2 Version\n */\n V2 = \"2020-09-15_Preview\",\n}\n\n/**\n * Default Breeze endpoint.\n * @internal\n */\nexport const DEFAULT_BREEZE_ENDPOINT = \"https://dc.services.visualstudio.com\";\n/**\n * Default Breeze API version.\n * @internal\n */\nexport const DEFAULT_BREEZE_API_VERSION = ServiceApiVersion.V2;\n/**\n * Default Live Metrics endpoint.\n * @internal\n */\nexport const DEFAULT_LIVEMETRICS_ENDPOINT = \"https://rt.services.visualstudio.com\";\n/**\n * Default Live Metrics host.\n * @internal\n */\nexport const DEFAULT_LIVEMETRICS_HOST = \"rt.services.visualstudio.com\";\n/**\n * Connection string environment variable name.\n * @internal\n */\nexport const ENV_CONNECTION_STRING = \"APPLICATIONINSIGHTS_CONNECTION_STRING\";\n/**\n * Instrumentation key environment variable name.\n * @internal\n */\nexport const ENV_INSTRUMENTATION_KEY = \"APPINSIGHTS_INSTRUMENTATIONKEY\";\n\n/**\n * QuickPulse metric counter names.\n * @internal\n */\nexport enum QuickPulseCounter {\n // Memory\n COMMITTED_BYTES = \"\\\\Memory\\\\Committed Bytes\",\n\n // CPU\n PROCESSOR_TIME = \"\\\\Processor(_Total)\\\\% Processor Time\",\n\n // Request\n REQUEST_RATE = \"\\\\ApplicationInsights\\\\Requests/Sec\",\n REQUEST_FAILURE_RATE = \"\\\\ApplicationInsights\\\\Requests Failed/Sec\",\n REQUEST_DURATION = \"\\\\ApplicationInsights\\\\Request Duration\",\n\n // Dependency\n DEPENDENCY_RATE = \"\\\\ApplicationInsights\\\\Dependency Calls/Sec\",\n DEPENDENCY_FAILURE_RATE = \"\\\\ApplicationInsights\\\\Dependency Calls Failed/Sec\",\n DEPENDENCY_DURATION = \"\\\\ApplicationInsights\\\\Dependency Call Duration\",\n\n // Exception\n EXCEPTION_RATE = \"\\\\ApplicationInsights\\\\Exceptions/Sec\",\n}\n\n/**\n * Performance metric counter names.\n * @internal\n */\nexport enum PerformanceCounter {\n // Memory\n PRIVATE_BYTES = \"\\\\Process(??APP_WIN32_PROC??)\\\\Private Bytes\",\n AVAILABLE_BYTES = \"\\\\Memory\\\\Available Bytes\",\n\n // CPU\n PROCESSOR_TIME = \"\\\\Processor(_Total)\\\\% Processor Time\",\n PROCESS_TIME = \"\\\\Process(??APP_WIN32_PROC??)\\\\% Processor Time\",\n\n // Requests\n REQUEST_RATE = \"\\\\ASP.NET Applications(??APP_W3SVC_PROC??)\\\\Requests/Sec\",\n REQUEST_DURATION = \"\\\\ASP.NET Applications(??APP_W3SVC_PROC??)\\\\Request Execution Time\",\n}\n\n/**\n * Map a PerformanceCounter/QuickPulseCounter to a QuickPulseCounter. If no mapping exists, mapping is *undefined*\n * @internal\n */\nexport const PerformanceToQuickPulseCounter: { [key: string]: QuickPulseCounter } = {\n [PerformanceCounter.PROCESSOR_TIME]: QuickPulseCounter.PROCESSOR_TIME,\n [PerformanceCounter.REQUEST_RATE]: QuickPulseCounter.REQUEST_RATE,\n [PerformanceCounter.REQUEST_DURATION]: QuickPulseCounter.REQUEST_DURATION,\n\n // Remap quick pulse only counters\n [QuickPulseCounter.COMMITTED_BYTES]: QuickPulseCounter.COMMITTED_BYTES,\n [QuickPulseCounter.REQUEST_FAILURE_RATE]: QuickPulseCounter.REQUEST_FAILURE_RATE,\n [QuickPulseCounter.DEPENDENCY_RATE]: QuickPulseCounter.DEPENDENCY_RATE,\n [QuickPulseCounter.DEPENDENCY_FAILURE_RATE]: QuickPulseCounter.DEPENDENCY_FAILURE_RATE,\n [QuickPulseCounter.DEPENDENCY_DURATION]: QuickPulseCounter.DEPENDENCY_DURATION,\n [QuickPulseCounter.EXCEPTION_RATE]: QuickPulseCounter.EXCEPTION_RATE,\n};\n\n/**\n * QuickPulse document types.\n * @internal\n */\nexport type QuickPulseDocumentType =\n | \"Event\"\n | \"Exception\"\n | \"Trace\"\n | \"Metric\"\n | \"Request\"\n | \"RemoteDependency\"\n | \"Availability\";\n/**\n * QuickPulse telemetry types.\n * @internal\n */\nexport type QuickPulseType =\n | \"EventTelemetryDocument\"\n | \"ExceptionTelemetryDocument\"\n | \"TraceTelemetryDocument\"\n | \"MetricTelemetryDocument\"\n | \"RequestTelemetryDocument\"\n | \"DependencyTelemetryDocument\"\n | \"AvailabilityTelemetryDocument\";\n"]}
|
package/dist-esm/src/config.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { DEFAULT_BREEZE_API_VERSION, DEFAULT_BREEZE_ENDPOINT } from "./Declarations/Constants";
|
|
1
|
+
import { DEFAULT_BREEZE_API_VERSION, DEFAULT_BREEZE_ENDPOINT, } from "./Declarations/Constants";
|
|
4
2
|
const DEFAULT_BATCH_SEND_RETRY_INTERVAL_MS = 60000;
|
|
5
3
|
const DEFAULT_MAX_CONSECUTIVE_FAILURES_BEFORE_WARNING = 10;
|
|
6
4
|
/**
|
|
@@ -12,6 +10,6 @@ export const DEFAULT_EXPORTER_CONFIG = {
|
|
|
12
10
|
endpointUrl: DEFAULT_BREEZE_ENDPOINT,
|
|
13
11
|
batchSendRetryIntervalMs: DEFAULT_BATCH_SEND_RETRY_INTERVAL_MS,
|
|
14
12
|
maxConsecutiveFailuresBeforeWarning: DEFAULT_MAX_CONSECUTIVE_FAILURES_BEFORE_WARNING,
|
|
15
|
-
apiVersion: DEFAULT_BREEZE_API_VERSION
|
|
13
|
+
apiVersion: DEFAULT_BREEZE_API_VERSION,
|
|
16
14
|
};
|
|
17
15
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GAExB,MAAM,0BAA0B,CAAC;AAElC,MAAM,oCAAoC,GAAG,KAAM,CAAC;AACpD,MAAM,+CAA+C,GAAG,EAAE,CAAC;AAkC3D;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAgC;IAClE,kBAAkB,EAAE,EAAE;IACtB,WAAW,EAAE,uBAAuB;IACpC,wBAAwB,EAAE,oCAAoC;IAC9D,mCAAmC,EAAE,+CAA+C;IACpF,UAAU,EAAE,0BAA0B;CACvC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { TokenCredential } from \"@azure/core-http\";\nimport {\n DEFAULT_BREEZE_API_VERSION,\n DEFAULT_BREEZE_ENDPOINT,\n ServiceApiVersion,\n} from \"./Declarations/Constants\";\n\nconst DEFAULT_BATCH_SEND_RETRY_INTERVAL_MS = 60_000;\nconst DEFAULT_MAX_CONSECUTIVE_FAILURES_BEFORE_WARNING = 10;\n\n/**\n * Provides configuration options for AzureMonitorTraceExporter.\n */\nexport interface AzureExporterConfig {\n /**\n * Azure Monitor Connection String, if not provided the exporter will try to use environment variable APPLICATIONINSIGHTS_CONNECTION_STRING\n * Ex: \"InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://dc.services.visualstudio.com\"\n */\n connectionString?: string;\n /**\n * Azure service API version.\n */\n apiVersion?: ServiceApiVersion;\n /**\n * Azure Active Directory Credential\n */\n aadTokenCredential?: TokenCredential;\n}\n\n/**\n * Internal Azure exporter configuration\n * @internal\n */\nexport interface AzureExporterInternalConfig {\n instrumentationKey: string;\n batchSendRetryIntervalMs: number;\n maxConsecutiveFailuresBeforeWarning: number;\n endpointUrl: string;\n apiVersion: ServiceApiVersion;\n aadTokenCredential?: TokenCredential;\n}\n\n/**\n * Internal default Azure exporter configuration\n * @internal\n */\nexport const DEFAULT_EXPORTER_CONFIG: AzureExporterInternalConfig = {\n instrumentationKey: \"\",\n endpointUrl: DEFAULT_BREEZE_ENDPOINT,\n batchSendRetryIntervalMs: DEFAULT_BATCH_SEND_RETRY_INTERVAL_MS,\n maxConsecutiveFailuresBeforeWarning: DEFAULT_MAX_CONSECUTIVE_FAILURES_BEFORE_WARNING,\n apiVersion: DEFAULT_BREEZE_API_VERSION,\n};\n"]}
|
|
@@ -4,7 +4,7 @@ import { diag } from "@opentelemetry/api";
|
|
|
4
4
|
import { ExportResultCode } from "@opentelemetry/core";
|
|
5
5
|
import { ConnectionStringParser } from "../utils/connectionStringParser";
|
|
6
6
|
import { HttpSender, FileSystemPersist } from "../platform";
|
|
7
|
-
import { DEFAULT_EXPORTER_CONFIG } from "../config";
|
|
7
|
+
import { DEFAULT_EXPORTER_CONFIG, } from "../config";
|
|
8
8
|
import { isRetriable } from "../utils/breezeUtils";
|
|
9
9
|
import { ENV_CONNECTION_STRING } from "../Declarations/Constants";
|
|
10
10
|
import { readableSpanToEnvelope } from "../utils/spanUtils";
|
|
@@ -22,6 +22,7 @@ export class AzureMonitorTraceExporter {
|
|
|
22
22
|
const connectionString = options.connectionString || process.env[ENV_CONNECTION_STRING];
|
|
23
23
|
this._options = Object.assign({}, DEFAULT_EXPORTER_CONFIG);
|
|
24
24
|
this._options.apiVersion = (_a = options.apiVersion) !== null && _a !== void 0 ? _a : this._options.apiVersion;
|
|
25
|
+
this._options.aadTokenCredential = options.aadTokenCredential;
|
|
25
26
|
if (connectionString) {
|
|
26
27
|
const parsedConnectionString = ConnectionStringParser.parse(connectionString);
|
|
27
28
|
this._options.instrumentationKey =
|
|
@@ -47,7 +48,7 @@ export class AzureMonitorTraceExporter {
|
|
|
47
48
|
? { code: ExportResultCode.SUCCESS }
|
|
48
49
|
: {
|
|
49
50
|
code: ExportResultCode.FAILED,
|
|
50
|
-
error: new Error("Failed to persist envelope in disk.")
|
|
51
|
+
error: new Error("Failed to persist envelope in disk."),
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
catch (ex) {
|
|
@@ -87,7 +88,7 @@ export class AzureMonitorTraceExporter {
|
|
|
87
88
|
}
|
|
88
89
|
// Failed -- not retriable
|
|
89
90
|
return {
|
|
90
|
-
code: ExportResultCode.FAILED
|
|
91
|
+
code: ExportResultCode.FAILED,
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
else {
|
|
@@ -98,7 +99,7 @@ export class AzureMonitorTraceExporter {
|
|
|
98
99
|
else {
|
|
99
100
|
// Failed -- not retriable
|
|
100
101
|
return {
|
|
101
|
-
code: ExportResultCode.FAILED
|
|
102
|
+
code: ExportResultCode.FAILED,
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -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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AE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;SAC5D;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,KAAqB,EACrB,cAA8C;QAE9C,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,MAAM,sCAAsC,CAAC,CAAC;QAC3E,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnC,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAC/D,CAAC;QACF,cAAc,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEO,KAAK,CAAC,uBAAuB;QACnC,IAAI;YACF,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAsB,CAAC;YACvE,IAAI,SAAS,EAAE;gBACb,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACpC;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC;IAEO,eAAe,CAAC,KAAgB;QACtC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,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/tracing\";\nimport { RestError } from \"@azure/core-http\";\nimport { ConnectionStringParser } from \"../utils/connectionStringParser\";\nimport { HttpSender, FileSystemPersist } from \"../platform\";\nimport {\n DEFAULT_EXPORTER_CONFIG,\n AzureExporterConfig,\n AzureExporterInternalConfig\n} from \"../config\";\nimport { PersistentStorage, Sender } from \"../types\";\nimport { isRetriable, BreezeResponse } from \"../utils/breezeUtils\";\nimport { ENV_CONNECTION_STRING } from \"../Declarations/Constants\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { readableSpanToEnvelope } from \"../utils/spanUtils\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Exporter.\n */\nexport class AzureMonitorTraceExporter implements SpanExporter {\n private readonly _persister: PersistentStorage;\n private readonly _sender: Sender;\n private _numConsecutiveRedirects: number;\n private _retryTimer: NodeJS.Timer | null;\n private readonly _options: AzureExporterInternalConfig;\n\n /**\n * Initializes a new instance of the AzureMonitorTraceExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n constructor(options: AzureExporterConfig = {}) {\n this._numConsecutiveRedirects = 0;\n const connectionString = options.connectionString || process.env[ENV_CONNECTION_STRING];\n this._options = {\n ...DEFAULT_EXPORTER_CONFIG\n };\n this._options.apiVersion = options.apiVersion ?? this._options.apiVersion;\n\n if (connectionString) {\n const parsedConnectionString = ConnectionStringParser.parse(connectionString);\n this._options.instrumentationKey =\n parsedConnectionString.instrumentationkey ?? this._options.instrumentationKey;\n this._options.endpointUrl =\n parsedConnectionString.ingestionendpoint?.trim() ?? this._options.endpointUrl;\n }\n // Instrumentation key is required\n if (!this._options.instrumentationKey) {\n const message =\n \"No instrumentation key or connection string was provided to the Azure Monitor Exporter\";\n diag.error(message);\n throw new Error(message);\n }\n\n this._sender = new HttpSender(this._options);\n this._persister = new FileSystemPersist(this._options);\n this._retryTimer = null;\n diag.debug(\"AzureMonitorTraceExporter was successfully setup\");\n }\n\n private async _persist(envelopes: unknown[]): Promise<ExportResult> {\n try {\n const success = await this._persister.push(envelopes);\n return success\n ? { code: ExportResultCode.SUCCESS }\n : {\n code: ExportResultCode.FAILED,\n error: new Error(\"Failed to persist envelope in disk.\")\n };\n } catch (ex) {\n return { code: ExportResultCode.FAILED, error: ex };\n }\n }\n\n private async exportEnvelopes(envelopes: Envelope[]): Promise<ExportResult> {\n diag.info(`Exporting ${envelopes.length} envelope(s)`);\n\n try {\n const { result, statusCode } = await this._sender.send(envelopes);\n this._numConsecutiveRedirects = 0;\n if (statusCode === 200) {\n // Success -- @todo: start retry timer\n if (!this._retryTimer) {\n this._retryTimer = setTimeout(() => {\n this._retryTimer = null;\n this._sendFirstPersistedFile();\n }, this._options.batchSendRetryIntervalMs);\n this._retryTimer.unref();\n }\n return { code: ExportResultCode.SUCCESS };\n } else if (statusCode && isRetriable(statusCode)) {\n // Failed -- persist failed data\n if (result) {\n diag.info(result);\n const breezeResponse = JSON.parse(result) as BreezeResponse;\n const filteredEnvelopes: Envelope[] = [];\n breezeResponse.errors.forEach((error) => {\n if (error.statusCode && isRetriable(error.statusCode)) {\n filteredEnvelopes.push(envelopes[error.index]);\n }\n });\n if (filteredEnvelopes.length > 0) {\n // calls resultCallback(ExportResult) based on result of persister.push\n return await this._persist(filteredEnvelopes);\n }\n // Failed -- not retriable\n return {\n code: ExportResultCode.FAILED\n };\n } else {\n // calls resultCallback(ExportResult) based on result of persister.push\n return await this._persist(envelopes);\n }\n } else {\n // Failed -- not retriable\n return {\n code: ExportResultCode.FAILED\n };\n }\n } catch (error) {\n const restError = error as RestError;\n if (\n restError.statusCode &&\n (restError.statusCode === 307 || // Temporary redirect\n restError.statusCode === 308)\n ) {\n // Permanent redirect\n this._numConsecutiveRedirects++;\n // To prevent circular redirects\n if (this._numConsecutiveRedirects < 10) {\n if (restError.response && restError.response.headers) {\n const location = restError.response.headers.get(\"location\");\n if (location) {\n // Update sender URL\n this._sender.handlePermanentRedirect(location);\n // Send to redirect endpoint as HTTPs library doesn't handle redirect automatically\n return this.exportEnvelopes(envelopes);\n }\n }\n } else {\n return { code: ExportResultCode.FAILED, error: new Error(\"Circular redirect\") };\n }\n } else if (restError.statusCode && isRetriable(restError.statusCode)) {\n return await this._persist(envelopes);\n }\n if (this._isNetworkError(restError)) {\n diag.error(\n \"Retrying due to transient client side error. Error message:\",\n restError.message\n );\n return await this._persist(envelopes);\n }\n\n diag.error(\n \"Envelopes could not be exported and are not retriable. Error message:\",\n restError.message\n );\n return { code: ExportResultCode.FAILED, error: restError };\n }\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 diag.info(`Exporting ${spans.length} span(s). Converting to envelopes...`);\n const envelopes = spans.map((span) =>\n readableSpanToEnvelope(span, this._options.instrumentationKey)\n );\n resultCallback(await this.exportEnvelopes(envelopes));\n }\n\n /**\n * Shutdown AzureMonitorTraceExporter.\n */\n async shutdown(): Promise<void> {\n diag.info(\"Azure Monitor Trace Exporter shutting down\");\n return this._sender.shutdown();\n }\n\n private async _sendFirstPersistedFile(): Promise<void> {\n try {\n const envelopes = (await this._persister.shift()) as Envelope[] | null;\n if (envelopes) {\n await this._sender.send(envelopes);\n }\n } catch (err) {\n diag.warn(`Failed to fetch persisted file`, err);\n }\n }\n\n private _isNetworkError(error: RestError): boolean {\n if (error && error.code && error.code === \"REQUEST_SEND_ERROR\") {\n return true;\n }\n return false;\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;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,O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F,OAAO,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;SAC5D;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,KAAqB,EACrB,cAA8C;QAE9C,IAAI,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,MAAM,sCAAsC,CAAC,CAAC;QAC3E,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACnC,sBAAsB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAC/D,CAAC;QACF,cAAc,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEO,KAAK,CAAC,uBAAuB;QACnC,IAAI;YACF,MAAM,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAsB,CAAC;YACvE,IAAI,SAAS,EAAE;gBACb,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACpC;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;SAClD;IACH,CAAC;IAEO,eAAe,CAAC,KAAgB;QACtC,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,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 { RestError } from \"@azure/core-rest-pipeline\";\nimport { ConnectionStringParser } from \"../utils/connectionStringParser\";\nimport { HttpSender, FileSystemPersist } from \"../platform\";\nimport {\n DEFAULT_EXPORTER_CONFIG,\n AzureExporterConfig,\n AzureExporterInternalConfig,\n} from \"../config\";\nimport { PersistentStorage, Sender } from \"../types\";\nimport { isRetriable, BreezeResponse } from \"../utils/breezeUtils\";\nimport { ENV_CONNECTION_STRING } from \"../Declarations/Constants\";\nimport { TelemetryItem as Envelope } from \"../generated\";\nimport { readableSpanToEnvelope } from \"../utils/spanUtils\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Exporter.\n */\nexport class AzureMonitorTraceExporter implements SpanExporter {\n private readonly _persister: PersistentStorage;\n private readonly _sender: Sender;\n private _numConsecutiveRedirects: number;\n private _retryTimer: NodeJS.Timer | null;\n private readonly _options: AzureExporterInternalConfig;\n\n /**\n * Initializes a new instance of the AzureMonitorTraceExporter class.\n * @param AzureExporterConfig - Exporter configuration.\n */\n constructor(options: AzureExporterConfig = {}) {\n this._numConsecutiveRedirects = 0;\n const connectionString = options.connectionString || process.env[ENV_CONNECTION_STRING];\n this._options = {\n ...DEFAULT_EXPORTER_CONFIG,\n };\n this._options.apiVersion = options.apiVersion ?? this._options.apiVersion;\n this._options.aadTokenCredential = options.aadTokenCredential;\n\n if (connectionString) {\n const parsedConnectionString = ConnectionStringParser.parse(connectionString);\n this._options.instrumentationKey =\n parsedConnectionString.instrumentationkey ?? this._options.instrumentationKey;\n this._options.endpointUrl =\n parsedConnectionString.ingestionendpoint?.trim() ?? this._options.endpointUrl;\n }\n // Instrumentation key is required\n if (!this._options.instrumentationKey) {\n const message =\n \"No instrumentation key or connection string was provided to the Azure Monitor Exporter\";\n diag.error(message);\n throw new Error(message);\n }\n\n this._sender = new HttpSender(this._options);\n this._persister = new FileSystemPersist(this._options);\n this._retryTimer = null;\n diag.debug(\"AzureMonitorTraceExporter was successfully setup\");\n }\n\n private async _persist(envelopes: unknown[]): Promise<ExportResult> {\n try {\n const success = await this._persister.push(envelopes);\n return success\n ? { code: ExportResultCode.SUCCESS }\n : {\n code: ExportResultCode.FAILED,\n error: new Error(\"Failed to persist envelope in disk.\"),\n };\n } catch (ex) {\n return { code: ExportResultCode.FAILED, error: ex };\n }\n }\n\n private async exportEnvelopes(envelopes: Envelope[]): Promise<ExportResult> {\n diag.info(`Exporting ${envelopes.length} envelope(s)`);\n\n try {\n const { result, statusCode } = await this._sender.send(envelopes);\n this._numConsecutiveRedirects = 0;\n if (statusCode === 200) {\n // Success -- @todo: start retry timer\n if (!this._retryTimer) {\n this._retryTimer = setTimeout(() => {\n this._retryTimer = null;\n this._sendFirstPersistedFile();\n }, this._options.batchSendRetryIntervalMs);\n this._retryTimer.unref();\n }\n return { code: ExportResultCode.SUCCESS };\n } else if (statusCode && isRetriable(statusCode)) {\n // Failed -- persist failed data\n if (result) {\n diag.info(result);\n const breezeResponse = JSON.parse(result) as BreezeResponse;\n const filteredEnvelopes: Envelope[] = [];\n breezeResponse.errors.forEach((error) => {\n if (error.statusCode && isRetriable(error.statusCode)) {\n filteredEnvelopes.push(envelopes[error.index]);\n }\n });\n if (filteredEnvelopes.length > 0) {\n // calls resultCallback(ExportResult) based on result of persister.push\n return await this._persist(filteredEnvelopes);\n }\n // Failed -- not retriable\n return {\n code: ExportResultCode.FAILED,\n };\n } else {\n // calls resultCallback(ExportResult) based on result of persister.push\n return await this._persist(envelopes);\n }\n } else {\n // Failed -- not retriable\n return {\n code: ExportResultCode.FAILED,\n };\n }\n } catch (error) {\n const restError = error as RestError;\n if (\n restError.statusCode &&\n (restError.statusCode === 307 || // Temporary redirect\n restError.statusCode === 308)\n ) {\n // Permanent redirect\n this._numConsecutiveRedirects++;\n // To prevent circular redirects\n if (this._numConsecutiveRedirects < 10) {\n if (restError.response && restError.response.headers) {\n const location = restError.response.headers.get(\"location\");\n if (location) {\n // Update sender URL\n this._sender.handlePermanentRedirect(location);\n // Send to redirect endpoint as HTTPs library doesn't handle redirect automatically\n return this.exportEnvelopes(envelopes);\n }\n }\n } else {\n return { code: ExportResultCode.FAILED, error: new Error(\"Circular redirect\") };\n }\n } else if (restError.statusCode && isRetriable(restError.statusCode)) {\n return await this._persist(envelopes);\n }\n if (this._isNetworkError(restError)) {\n diag.error(\n \"Retrying due to transient client side error. Error message:\",\n restError.message\n );\n return await this._persist(envelopes);\n }\n\n diag.error(\n \"Envelopes could not be exported and are not retriable. Error message:\",\n restError.message\n );\n return { code: ExportResultCode.FAILED, error: restError };\n }\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 diag.info(`Exporting ${spans.length} span(s). Converting to envelopes...`);\n const envelopes = spans.map((span) =>\n readableSpanToEnvelope(span, this._options.instrumentationKey)\n );\n resultCallback(await this.exportEnvelopes(envelopes));\n }\n\n /**\n * Shutdown AzureMonitorTraceExporter.\n */\n async shutdown(): Promise<void> {\n diag.info(\"Azure Monitor Trace Exporter shutting down\");\n return this._sender.shutdown();\n }\n\n private async _sendFirstPersistedFile(): Promise<void> {\n try {\n const envelopes = (await this._persister.shift()) as Envelope[] | null;\n if (envelopes) {\n await this._sender.send(envelopes);\n }\n } catch (err) {\n diag.warn(`Failed to fetch persisted file`, err);\n }\n }\n\n private _isNetworkError(error: RestError): boolean {\n if (error && error.code && error.code === \"REQUEST_SEND_ERROR\") {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as coreClient from "@azure/core-client";
|
|
9
9
|
import * as Parameters from "./models/parameters";
|
|
10
10
|
import * as Mappers from "./models/mappers";
|
|
11
11
|
import { ApplicationInsightsClientContext } from "./applicationInsightsClientContext";
|
|
@@ -23,12 +23,11 @@ export class ApplicationInsightsClient extends ApplicationInsightsClientContext
|
|
|
23
23
|
* @param options The options parameters.
|
|
24
24
|
*/
|
|
25
25
|
track(body, options) {
|
|
26
|
-
|
|
27
|
-
return this.sendOperationRequest({ body, options: operationOptions }, trackOperationSpec);
|
|
26
|
+
return this.sendOperationRequest({ body, options }, trackOperationSpec);
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
// Operation Specifications
|
|
31
|
-
const serializer =
|
|
30
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
32
31
|
const trackOperationSpec = {
|
|
33
32
|
path: "/track",
|
|
34
33
|
httpMethod: "POST",
|
|
@@ -40,19 +39,24 @@ const trackOperationSpec = {
|
|
|
40
39
|
bodyMapper: Mappers.TrackResponse
|
|
41
40
|
},
|
|
42
41
|
400: {
|
|
43
|
-
bodyMapper: Mappers.TrackResponse
|
|
42
|
+
bodyMapper: Mappers.TrackResponse,
|
|
43
|
+
isError: true
|
|
44
44
|
},
|
|
45
45
|
402: {
|
|
46
|
-
bodyMapper: Mappers.TrackResponse
|
|
46
|
+
bodyMapper: Mappers.TrackResponse,
|
|
47
|
+
isError: true
|
|
47
48
|
},
|
|
48
49
|
429: {
|
|
49
|
-
bodyMapper: Mappers.TrackResponse
|
|
50
|
+
bodyMapper: Mappers.TrackResponse,
|
|
51
|
+
isError: true
|
|
50
52
|
},
|
|
51
53
|
500: {
|
|
52
|
-
bodyMapper: Mappers.TrackResponse
|
|
54
|
+
bodyMapper: Mappers.TrackResponse,
|
|
55
|
+
isError: true
|
|
53
56
|
},
|
|
54
57
|
503: {
|
|
55
|
-
bodyMapper: Mappers.TrackResponse
|
|
58
|
+
bodyMapper: Mappers.TrackResponse,
|
|
59
|
+
isError: true
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
requestBody: Parameters.body,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationInsightsClient.js","sourceRoot":"","sources":["../../../src/generated/applicationInsightsClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
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;AAC5C,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAQtF,MAAM,OAAO,yBAA0B,SAAQ,gCAAgC;IAC7E;;;OAGG;IACH,YAAY,OAAiD;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,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 Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport { ApplicationInsightsClientContext } from \"./applicationInsightsClientContext\";\nimport {\n ApplicationInsightsClientOptionalParams,\n TelemetryItem,\n TrackOptionalParams,\n TrackOperationResponse\n} from \"./models\";\n\nexport class ApplicationInsightsClient extends ApplicationInsightsClientContext {\n /**\n * Initializes a new instance of the ApplicationInsightsClient class.\n * @param options The parameter options\n */\n constructor(options?: ApplicationInsightsClientOptionalParams) {\n super(options);\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"]}
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
|
|
10
|
-
const packageVersion = "1.0.0-beta.2";
|
|
11
|
-
export class ApplicationInsightsClientContext extends coreHttp.ServiceClient {
|
|
8
|
+
import * as coreClient from "@azure/core-client";
|
|
9
|
+
export class ApplicationInsightsClientContext extends coreClient.ServiceClient {
|
|
12
10
|
/**
|
|
13
11
|
* Initializes a new instance of the ApplicationInsightsClientContext class.
|
|
14
12
|
* @param options The parameter options
|
|
@@ -18,13 +16,17 @@ export class ApplicationInsightsClientContext extends coreHttp.ServiceClient {
|
|
|
18
16
|
if (!options) {
|
|
19
17
|
options = {};
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const defaults = {
|
|
20
|
+
requestContentType: "application/json; charset=utf-8"
|
|
21
|
+
};
|
|
22
|
+
const packageDetails = `azsdk-js-monitor-opentelemetry-exporter/1.0.0-beta.7`;
|
|
23
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
24
|
+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
25
|
+
: `${packageDetails}`;
|
|
26
|
+
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
27
|
+
userAgentPrefix
|
|
28
|
+
}, baseUri: options.endpoint || "{Host}/v2.1" });
|
|
29
|
+
super(optionsWithDefaults);
|
|
28
30
|
// Assigning values to Constant parameters
|
|
29
31
|
this.host = options.host || "https://dc.services.visualstudio.com";
|
|
30
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationInsightsClientContext.js","sourceRoot":"","sources":["../../../src/generated/applicationInsightsClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"applicationInsightsClientContext.js","sourceRoot":"","sources":["../../../src/generated/applicationInsightsClientContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAGjD,MAAM,OAAO,gCAAiC,SAAQ,UAAU,CAAC,aAAa;IAG5E;;;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,CAAC;QAEF,MAAM,cAAc,GAAG,sDAAsD,CAAC;QAC9E,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;YAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,cAAc,EAAE;YACjE,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;QAE1B,MAAM,mBAAmB,iDACpB,QAAQ,GACR,OAAO,KACV,gBAAgB,EAAE;gBAChB,eAAe;aAChB,EACD,OAAO,EAAE,OAAO,CAAC,QAAQ,IAAI,aAAa,GAC3C,CAAC;QACF,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE3B,0CAA0C;QAC1C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,sCAAsC,CAAC;IACrE,CAAC;CACF","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 { ApplicationInsightsClientOptionalParams } from \"./models\";\n\nexport class ApplicationInsightsClientContext extends coreClient.ServiceClient {\n host: string;\n\n /**\n * Initializes a new instance of the ApplicationInsightsClientContext 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.7`;\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 || \"{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"]}
|
|
@@ -5,5 +5,51 @@
|
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
/** Known values of {@link DataPointType} that the service accepts. */
|
|
9
|
+
export var KnownDataPointType;
|
|
10
|
+
(function (KnownDataPointType) {
|
|
11
|
+
KnownDataPointType["Measurement"] = "Measurement";
|
|
12
|
+
KnownDataPointType["Aggregation"] = "Aggregation";
|
|
13
|
+
})(KnownDataPointType || (KnownDataPointType = {}));
|
|
14
|
+
/** Known values of {@link SeverityLevel} that the service accepts. */
|
|
15
|
+
export var KnownSeverityLevel;
|
|
16
|
+
(function (KnownSeverityLevel) {
|
|
17
|
+
KnownSeverityLevel["Verbose"] = "Verbose";
|
|
18
|
+
KnownSeverityLevel["Information"] = "Information";
|
|
19
|
+
KnownSeverityLevel["Warning"] = "Warning";
|
|
20
|
+
KnownSeverityLevel["Error"] = "Error";
|
|
21
|
+
KnownSeverityLevel["Critical"] = "Critical";
|
|
22
|
+
})(KnownSeverityLevel || (KnownSeverityLevel = {}));
|
|
23
|
+
/** Known values of {@link ContextTagKeys} that the service accepts. */
|
|
24
|
+
export var KnownContextTagKeys;
|
|
25
|
+
(function (KnownContextTagKeys) {
|
|
26
|
+
KnownContextTagKeys["AiApplicationVer"] = "ai.application.ver";
|
|
27
|
+
KnownContextTagKeys["AiDeviceId"] = "ai.device.id";
|
|
28
|
+
KnownContextTagKeys["AiDeviceLocale"] = "ai.device.locale";
|
|
29
|
+
KnownContextTagKeys["AiDeviceModel"] = "ai.device.model";
|
|
30
|
+
KnownContextTagKeys["AiDeviceOemName"] = "ai.device.oemName";
|
|
31
|
+
KnownContextTagKeys["AiDeviceOsVersion"] = "ai.device.osVersion";
|
|
32
|
+
KnownContextTagKeys["AiDeviceType"] = "ai.device.type";
|
|
33
|
+
KnownContextTagKeys["AiLocationIp"] = "ai.location.ip";
|
|
34
|
+
KnownContextTagKeys["AiLocationCountry"] = "ai.location.country";
|
|
35
|
+
KnownContextTagKeys["AiLocationProvince"] = "ai.location.province";
|
|
36
|
+
KnownContextTagKeys["AiLocationCity"] = "ai.location.city";
|
|
37
|
+
KnownContextTagKeys["AiOperationId"] = "ai.operation.id";
|
|
38
|
+
KnownContextTagKeys["AiOperationName"] = "ai.operation.name";
|
|
39
|
+
KnownContextTagKeys["AiOperationParentId"] = "ai.operation.parentId";
|
|
40
|
+
KnownContextTagKeys["AiOperationSyntheticSource"] = "ai.operation.syntheticSource";
|
|
41
|
+
KnownContextTagKeys["AiOperationCorrelationVector"] = "ai.operation.correlationVector";
|
|
42
|
+
KnownContextTagKeys["AiSessionId"] = "ai.session.id";
|
|
43
|
+
KnownContextTagKeys["AiSessionIsFirst"] = "ai.session.isFirst";
|
|
44
|
+
KnownContextTagKeys["AiUserAccountId"] = "ai.user.accountId";
|
|
45
|
+
KnownContextTagKeys["AiUserId"] = "ai.user.id";
|
|
46
|
+
KnownContextTagKeys["AiUserAuthUserId"] = "ai.user.authUserId";
|
|
47
|
+
KnownContextTagKeys["AiCloudRole"] = "ai.cloud.role";
|
|
48
|
+
KnownContextTagKeys["AiCloudRoleVer"] = "ai.cloud.roleVer";
|
|
49
|
+
KnownContextTagKeys["AiCloudRoleInstance"] = "ai.cloud.roleInstance";
|
|
50
|
+
KnownContextTagKeys["AiCloudLocation"] = "ai.cloud.location";
|
|
51
|
+
KnownContextTagKeys["AiInternalSdkVersion"] = "ai.internal.sdkVersion";
|
|
52
|
+
KnownContextTagKeys["AiInternalAgentVersion"] = "ai.internal.agentVersion";
|
|
53
|
+
KnownContextTagKeys["AiInternalNodeName"] = "ai.internal.nodeName";
|
|
54
|
+
})(KnownContextTagKeys || (KnownContextTagKeys = {}));
|
|
9
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","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 coreHttp from \"@azure/core-http\";\n\n/**\n * System variables for a telemetry item.\n */\nexport interface TelemetryItem {\n /**\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 */\n version?: number;\n /**\n * Type name of telemetry data item.\n */\n name: string;\n /**\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 */\n time: Date;\n /**\n * Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.\n */\n sampleRate?: number;\n /**\n * Sequence field used to track absolute order of uploaded events.\n */\n sequence?: string;\n /**\n * The instrumentation key of the Application Insights resource.\n */\n instrumentationKey?: string;\n /**\n * Key/value collection of context properties. See ContextTagKeys for information on available properties.\n */\n tags?: { [propertyName: string]: string };\n /**\n * Telemetry data item.\n */\n data?: MonitorBase;\n}\n\n/**\n * Data struct to contain only C section with custom fields.\n */\nexport interface MonitorBase {\n /**\n * Name of item (B section) if any. If telemetry data is derived straight from this, this should be null.\n */\n baseType?: string;\n /**\n * The data payload for the telemetry request\n */\n baseData?: MonitorDomain;\n}\n\n/**\n * The abstract common base of all domains.\n */\nexport interface MonitorDomain {\n /**\n * Describes unknown properties. The value of an unknown property can be of \"any\" type.\n */\n [property: string]: any;\n /**\n * Schema version\n */\n version: number;\n}\n\n/**\n * Response containing the status of each telemetry item.\n */\nexport interface TrackResponse {\n /**\n * The number of items received.\n */\n itemsReceived?: number;\n /**\n * The number of items accepted.\n */\n itemsAccepted?: number;\n /**\n * An array of error detail objects.\n */\n errors?: TelemetryErrorDetails[];\n}\n\n/**\n * The error details\n */\nexport interface TelemetryErrorDetails {\n /**\n * The index in the original payload of the item.\n */\n index?: number;\n /**\n * The item specific [HTTP Response status code](#Response Status Codes).\n */\n statusCode?: number;\n /**\n * The error message.\n */\n message?: string;\n}\n\n/**\n * Metric data single measurement.\n */\nexport interface MetricDataPoint {\n /**\n * Namespace of the metric.\n */\n namespace?: string;\n /**\n * Name of the metric.\n */\n name: string;\n /**\n * Metric type. Single measurement or the aggregated value.\n */\n dataPointType?: DataPointType;\n /**\n * Single value for measurement. Sum of individual measurements for the aggregation.\n */\n value: number;\n /**\n * Metric weight of the aggregated metric. Should not be set for a measurement.\n */\n count?: number;\n /**\n * Minimum value of the aggregated metric. Should not be set for a measurement.\n */\n min?: number;\n /**\n * Maximum value of the aggregated metric. Should not be set for a measurement.\n */\n max?: number;\n /**\n * Standard deviation of the aggregated metric. Should not be set for a measurement.\n */\n stdDev?: number;\n}\n\n/**\n * Exception details of the exception in a chain.\n */\nexport interface TelemetryExceptionDetails {\n /**\n * In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting.\n */\n id?: number;\n /**\n * The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception\n */\n outerId?: number;\n /**\n * Exception type name.\n */\n typeName?: string;\n /**\n * Exception message.\n */\n message: string;\n /**\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 */\n hasFullStack?: boolean;\n /**\n * Text describing the stack. Either stack or parsedStack should have a value.\n */\n stack?: string;\n /**\n * List of stack frames. Either stack or parsedStack should have a value.\n */\n parsedStack?: StackFrame[];\n}\n\n/**\n * Stack frame information.\n */\nexport interface StackFrame {\n level: number;\n /**\n * Method name.\n */\n method: string;\n /**\n * Name of the assembly (dll, jar, etc.) containing this function.\n */\n assembly?: string;\n /**\n * File name or URL of the method implementation.\n */\n fileName?: string;\n /**\n * Line number of the code implementation.\n */\n line?: number;\n}\n\n/**\n * Instances of AvailabilityData represent the result of executing an availability test.\n */\nexport type AvailabilityData = MonitorDomain & {\n /**\n * Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.\n */\n id: string;\n /**\n * Name of the test that these availability results represent.\n */\n name: string;\n /**\n * Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.\n */\n duration: string;\n /**\n * Success flag.\n */\n success: boolean;\n /**\n * Name of the location where the test was run from.\n */\n runLocation?: string;\n /**\n * Diagnostic message for the result.\n */\n message?: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\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.\n */\nexport type TelemetryEventData = MonitorDomain & {\n /**\n * Event name. Keep it low cardinality to allow proper grouping and useful metrics.\n */\n name: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\n\n/**\n * An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.\n */\nexport type TelemetryExceptionData = MonitorDomain & {\n /**\n * Exception chain - list of inner exceptions.\n */\n exceptions: TelemetryExceptionDetails[];\n /**\n * Severity level. Mostly used to indicate exception severity level when it is reported by logging library.\n */\n severityLevel?: SeverityLevel;\n /**\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 */\n problemId?: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\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.\n */\nexport type MessageData = MonitorDomain & {\n /**\n * Trace message\n */\n message: string;\n /**\n * Trace severity level.\n */\n severityLevel?: SeverityLevel;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\n\n/**\n * An instance of the Metric item is a list of measurements (single data points) and/or aggregations.\n */\nexport type MetricsData = MonitorDomain & {\n /**\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 */\n metrics: MetricDataPoint[];\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n};\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.\n */\nexport type PageViewData = MonitorDomain & {\n /**\n * Identifier of a page view instance. Used for correlation between page view and other telemetry items.\n */\n id: string;\n /**\n * Event name. Keep it low cardinality to allow proper grouping and useful metrics.\n */\n name: string;\n /**\n * Request URL with all query string parameters\n */\n url?: string;\n /**\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 */\n duration?: string;\n /**\n * Fully qualified page URI or URL of the referring page; if unknown, leave blank\n */\n referredUri?: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\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.\n */\nexport type PageViewPerfData = MonitorDomain & {\n /**\n * Identifier of a page view instance. Used for correlation between page view and other telemetry items.\n */\n id: string;\n /**\n * Event name. Keep it low cardinality to allow proper grouping and useful metrics.\n */\n name: string;\n /**\n * Request URL with all query string parameters\n */\n url?: string;\n /**\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 */\n duration?: string;\n /**\n * Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff\n */\n perfTotal?: string;\n /**\n * Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff\n */\n networkConnect?: string;\n /**\n * Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff\n */\n sentRequest?: string;\n /**\n * Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff\n */\n receivedResponse?: string;\n /**\n * DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff\n */\n domProcessing?: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\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.\n */\nexport type RemoteDependencyData = MonitorDomain & {\n /**\n * Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.\n */\n id?: string;\n /**\n * Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.\n */\n name: string;\n /**\n * Result code of a dependency call. Examples are SQL error code and HTTP status code.\n */\n resultCode?: string;\n /**\n * Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters.\n */\n data?: string;\n /**\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 */\n type?: string;\n /**\n * Target site of a dependency call. Examples are server name, host address.\n */\n target?: string;\n /**\n * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.\n */\n duration: string;\n /**\n * Indication of successful or unsuccessful call.\n */\n success?: boolean;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\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.\n */\nexport type RequestData = MonitorDomain & {\n /**\n * Identifier of a request call instance. Used for correlation between request and other telemetry items.\n */\n id: string;\n /**\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 */\n name?: string;\n /**\n * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.\n */\n duration: string;\n /**\n * Indication of successful or unsuccessful call.\n */\n success: boolean;\n /**\n * Result of a request execution. HTTP status code for HTTP requests.\n */\n responseCode: string;\n /**\n * Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller.\n */\n source?: string;\n /**\n * Request URL with all query string parameters.\n */\n url?: string;\n /**\n * Collection of custom properties.\n */\n properties?: { [propertyName: string]: string };\n /**\n * Collection of custom measurements.\n */\n measurements?: { [propertyName: string]: number };\n};\n/**\n * Defines values for DataPointType.\n */\nexport type DataPointType = \"Measurement\" | \"Aggregation\" | string;\n/**\n * Defines values for SeverityLevel.\n */\nexport type SeverityLevel =\n | \"Verbose\"\n | \"Information\"\n | \"Warning\"\n | \"Error\"\n | \"Critical\"\n | string;\n/**\n * Defines values for ContextTagKeys.\n */\nexport type ContextTagKeys =\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 | string;\n\n/**\n * Contains response data for the track operation.\n */\nexport type ApplicationInsightsClientTrackResponse = TrackResponse & {\n /**\n * The underlying HTTP response.\n */\n _response: coreHttp.HttpResponse & {\n /**\n * The response body as text (string format)\n */\n bodyAsText: string;\n\n /**\n * The response body as parsed JSON or XML\n */\n parsedBody: TrackResponse;\n };\n};\n\n/**\n * Optional parameters.\n */\nexport interface ApplicationInsightsClientOptionalParams\n extends coreHttp.ServiceClientOptions {\n /**\n * Breeze endpoint: https://dc.services.visualstudio.com\n */\n host?: string;\n /**\n * Overrides client endpoint.\n */\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,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,iDAA2B,CAAA;IAC3B,iDAA2B,CAAA;AAC7B,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAYD,sEAAsE;AACtE,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,iDAA2B,CAAA;IAC3B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,2CAAqB,CAAA;AACvB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B;AAeD,uEAAuE;AACvE,MAAM,CAAN,IAAY,mBA6BX;AA7BD,WAAY,mBAAmB;IAC7B,8DAAuC,CAAA;IACvC,kDAA2B,CAAA;IAC3B,0DAAmC,CAAA;IACnC,wDAAiC,CAAA;IACjC,4DAAqC,CAAA;IACrC,gEAAyC,CAAA;IACzC,sDAA+B,CAAA;IAC/B,sDAA+B,CAAA;IAC/B,gEAAyC,CAAA;IACzC,kEAA2C,CAAA;IAC3C,0DAAmC,CAAA;IACnC,wDAAiC,CAAA;IACjC,4DAAqC,CAAA;IACrC,oEAA6C,CAAA;IAC7C,kFAA2D,CAAA;IAC3D,sFAA+D,CAAA;IAC/D,oDAA6B,CAAA;IAC7B,8DAAuC,CAAA;IACvC,4DAAqC,CAAA;IACrC,8CAAuB,CAAA;IACvB,8DAAuC,CAAA;IACvC,oDAA6B,CAAA;IAC7B,0DAAmC,CAAA;IACnC,oEAA6C,CAAA;IAC7C,4DAAqC,CAAA;IACrC,sEAA+C,CAAA;IAC/C,0EAAmD,CAAA;IACnD,kEAA2C,CAAA;AAC7C,CAAC,EA7BW,mBAAmB,KAAnB,mBAAmB,QA6B9B","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 type AvailabilityData = 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 type TelemetryEventData = 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 type TelemetryExceptionData = 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 type MessageData = 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 type MetricsData = 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 type PageViewData = 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 type PageViewPerfData = 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 type RemoteDependencyData = 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 type RequestData = 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 = \"Measurement\",\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 = \"Verbose\",\n Information = \"Information\",\n Warning = \"Warning\",\n Error = \"Error\",\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 = \"ai.application.ver\",\n AiDeviceId = \"ai.device.id\",\n AiDeviceLocale = \"ai.device.locale\",\n AiDeviceModel = \"ai.device.model\",\n AiDeviceOemName = \"ai.device.oemName\",\n AiDeviceOsVersion = \"ai.device.osVersion\",\n AiDeviceType = \"ai.device.type\",\n AiLocationIp = \"ai.location.ip\",\n AiLocationCountry = \"ai.location.country\",\n AiLocationProvince = \"ai.location.province\",\n AiLocationCity = \"ai.location.city\",\n AiOperationId = \"ai.operation.id\",\n AiOperationName = \"ai.operation.name\",\n AiOperationParentId = \"ai.operation.parentId\",\n AiOperationSyntheticSource = \"ai.operation.syntheticSource\",\n AiOperationCorrelationVector = \"ai.operation.correlationVector\",\n AiSessionId = \"ai.session.id\",\n AiSessionIsFirst = \"ai.session.isFirst\",\n AiUserAccountId = \"ai.user.accountId\",\n AiUserId = \"ai.user.id\",\n AiUserAuthUserId = \"ai.user.authUserId\",\n AiCloudRole = \"ai.cloud.role\",\n AiCloudRoleVer = \"ai.cloud.roleVer\",\n AiCloudRoleInstance = \"ai.cloud.roleInstance\",\n AiCloudLocation = \"ai.cloud.location\",\n AiInternalSdkVersion = \"ai.internal.sdkVersion\",\n AiInternalAgentVersion = \"ai.internal.agentVersion\",\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"]}
|
|
@@ -130,7 +130,10 @@ export const TrackResponse = {
|
|
|
130
130
|
type: {
|
|
131
131
|
name: "Sequence",
|
|
132
132
|
element: {
|
|
133
|
-
type: {
|
|
133
|
+
type: {
|
|
134
|
+
name: "Composite",
|
|
135
|
+
className: "TelemetryErrorDetails"
|
|
136
|
+
}
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
139
|
}
|
|
@@ -202,24 +205,28 @@ export const MetricDataPoint = {
|
|
|
202
205
|
},
|
|
203
206
|
count: {
|
|
204
207
|
serializedName: "count",
|
|
208
|
+
nullable: true,
|
|
205
209
|
type: {
|
|
206
210
|
name: "Number"
|
|
207
211
|
}
|
|
208
212
|
},
|
|
209
213
|
min: {
|
|
210
214
|
serializedName: "min",
|
|
215
|
+
nullable: true,
|
|
211
216
|
type: {
|
|
212
217
|
name: "Number"
|
|
213
218
|
}
|
|
214
219
|
},
|
|
215
220
|
max: {
|
|
216
221
|
serializedName: "max",
|
|
222
|
+
nullable: true,
|
|
217
223
|
type: {
|
|
218
224
|
name: "Number"
|
|
219
225
|
}
|
|
220
226
|
},
|
|
221
227
|
stdDev: {
|
|
222
228
|
serializedName: "stdDev",
|
|
229
|
+
nullable: true,
|
|
223
230
|
type: {
|
|
224
231
|
name: "Number"
|
|
225
232
|
}
|
|
@@ -283,7 +290,12 @@ export const TelemetryExceptionDetails = {
|
|
|
283
290
|
serializedName: "parsedStack",
|
|
284
291
|
type: {
|
|
285
292
|
name: "Sequence",
|
|
286
|
-
element: {
|
|
293
|
+
element: {
|
|
294
|
+
type: {
|
|
295
|
+
name: "Composite",
|
|
296
|
+
className: "StackFrame"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
287
299
|
}
|
|
288
300
|
}
|
|
289
301
|
}
|
|
@@ -444,11 +456,15 @@ export const TelemetryExceptionData = {
|
|
|
444
456
|
type: {
|
|
445
457
|
name: "Sequence",
|
|
446
458
|
element: {
|
|
447
|
-
type: {
|
|
459
|
+
type: {
|
|
460
|
+
name: "Composite",
|
|
461
|
+
className: "TelemetryExceptionDetails"
|
|
462
|
+
}
|
|
448
463
|
}
|
|
449
464
|
}
|
|
450
465
|
}, severityLevel: {
|
|
451
466
|
serializedName: "severityLevel",
|
|
467
|
+
nullable: true,
|
|
452
468
|
type: {
|
|
453
469
|
name: "String"
|
|
454
470
|
}
|
|
@@ -519,7 +535,12 @@ export const MetricsData = {
|
|
|
519
535
|
required: true,
|
|
520
536
|
type: {
|
|
521
537
|
name: "Sequence",
|
|
522
|
-
element: {
|
|
538
|
+
element: {
|
|
539
|
+
type: {
|
|
540
|
+
name: "Composite",
|
|
541
|
+
className: "MetricDataPoint"
|
|
542
|
+
}
|
|
543
|
+
}
|
|
523
544
|
}
|
|
524
545
|
}, properties: {
|
|
525
546
|
serializedName: "properties",
|