@ms-cloudpack/telemetry 0.3.5 → 0.3.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/lib/AppInsights/AppInsightsTelemetryClient.d.ts +3 -1
- package/lib/AppInsights/AppInsightsTelemetryClient.d.ts.map +1 -1
- package/lib/AppInsights/AppInsightsTelemetryClient.js +9 -0
- package/lib/AppInsights/AppInsightsTelemetryClient.js.map +1 -1
- package/lib/AppInsights/getAppInsightsConfig.d.ts.map +1 -1
- package/lib/AppInsights/getAppInsightsConfig.js +4 -2
- package/lib/AppInsights/getAppInsightsConfig.js.map +1 -1
- package/lib/NoOp/NoOpTelemetryClient.d.ts +2 -0
- package/lib/NoOp/NoOpTelemetryClient.d.ts.map +1 -1
- package/lib/NoOp/NoOpTelemetryClient.js +2 -0
- package/lib/NoOp/NoOpTelemetryClient.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types/TelemetryClient.d.ts +5 -1
- package/lib/types/TelemetryClient.d.ts.map +1 -1
- package/lib/types/TelemetryClient.js.map +1 -1
- package/lib/types/TelemetryOptions.d.ts +4 -0
- package/lib/types/TelemetryOptions.d.ts.map +1 -1
- package/lib/types/TelemetryOptions.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { Tracer } from '@opentelemetry/api';
|
|
1
|
+
import type { Span, Tracer } from '@opentelemetry/api';
|
|
2
2
|
import type { TelemetryOptions } from '../types/TelemetryOptions.js';
|
|
3
3
|
import type { TelemetryClient } from '../types/TelemetryClient.js';
|
|
4
4
|
export declare class AppInsightsTelemetryClient implements TelemetryClient {
|
|
5
|
+
private readonly _rootSpan;
|
|
5
6
|
private readonly appInsightsClient;
|
|
6
7
|
private readonly sharedSpanAttributes;
|
|
7
8
|
constructor(options: TelemetryOptions);
|
|
9
|
+
get rootSpan(): Span;
|
|
8
10
|
/**
|
|
9
11
|
* Sets a shared attribute that will be added to all spans.
|
|
10
12
|
* @param key - key of the attribute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/AppInsights/AppInsightsTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AppInsightsTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/AppInsights/AppInsightsTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,qBAAa,0BAA2B,YAAW,eAAe;IAChE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAO;IACjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;gBAEvD,OAAO,EAAE,gBAAgB;IAqBrC,IAAW,QAAQ,IAAI,IAAI,CAE1B;IAED;;;;OAIG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxD;;OAEG;IACU,QAAQ;IAMrB;;;OAGG;IACI,SAAS,IAAI,MAAM;CAG3B"}
|
|
@@ -13,6 +13,14 @@ export class AppInsightsTelemetryClient {
|
|
|
13
13
|
// Set SpanEnrichingProcessor to add shared attributes to all spans
|
|
14
14
|
const nodeTraceProvider = this.appInsightsClient.getTraceHandler().getTracerProvider();
|
|
15
15
|
nodeTraceProvider.addSpanProcessor(new SpanEnrichingProcessor(() => this.sharedSpanAttributes));
|
|
16
|
+
// Create root span
|
|
17
|
+
this._rootSpan = this.appInsightsClient
|
|
18
|
+
.getTraceHandler()
|
|
19
|
+
.getTracer()
|
|
20
|
+
.startSpan(options.rootSpanName || 'root');
|
|
21
|
+
}
|
|
22
|
+
get rootSpan() {
|
|
23
|
+
return this._rootSpan;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Sets a shared attribute that will be added to all spans.
|
|
@@ -26,6 +34,7 @@ export class AppInsightsTelemetryClient {
|
|
|
26
34
|
* Flushes all telemetry and shuts down the telemetry client.
|
|
27
35
|
*/
|
|
28
36
|
async shutdown() {
|
|
37
|
+
this._rootSpan.end();
|
|
29
38
|
await this.appInsightsClient?.flush();
|
|
30
39
|
await this.appInsightsClient?.shutdown();
|
|
31
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsTelemetryClient.js","sourceRoot":"","sources":["../../src/AppInsights/AppInsightsTelemetryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,MAAM,OAAO,0BAA0B;
|
|
1
|
+
{"version":3,"file":"AppInsightsTelemetryClient.js","sourceRoot":"","sources":["../../src/AppInsights/AppInsightsTelemetryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,MAAM,OAAO,0BAA0B;IAKrC,YAAY,OAAyB;QAFpB,yBAAoB,GAA2B,EAAE,CAAC;QA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D,CAAC;CACF","sourcesContent":["import type { Span, Tracer } from '@opentelemetry/api';\nimport type { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';\nimport { ApplicationInsightsClient } from 'applicationinsights';\nimport { convertLogLevel } from './convertLogLevel.js';\nimport { getAppInsightsConfig } from './getAppInsightsConfig.js';\nimport { SpanEnrichingProcessor } from './SpanEnrichingProcessor.js';\nimport type { TelemetryOptions } from '../types/TelemetryOptions.js';\nimport type { TelemetryClient } from '../types/TelemetryClient.js';\n\nexport class AppInsightsTelemetryClient implements TelemetryClient {\n private readonly _rootSpan: Span;\n private readonly appInsightsClient: ApplicationInsightsClient;\n private readonly sharedSpanAttributes: Record<string, string> = {};\n\n constructor(options: TelemetryOptions) {\n const config = getAppInsightsConfig(options);\n\n this.appInsightsClient = new ApplicationInsightsClient(config);\n\n this.appInsightsClient.getLogger().updateLogLevel(convertLogLevel(options.logLevel));\n\n // Set shared attributes\n this.setSharedSpanAttribute('version', options.productVersion);\n\n // Set SpanEnrichingProcessor to add shared attributes to all spans\n const nodeTraceProvider = this.appInsightsClient.getTraceHandler().getTracerProvider() as NodeTracerProvider;\n nodeTraceProvider.addSpanProcessor(new SpanEnrichingProcessor(() => this.sharedSpanAttributes));\n\n // Create root span\n this._rootSpan = this.appInsightsClient\n .getTraceHandler()\n .getTracer()\n .startSpan(options.rootSpanName || 'root');\n }\n\n public get rootSpan(): Span {\n return this._rootSpan;\n }\n\n /**\n * Sets a shared attribute that will be added to all spans.\n * @param key - key of the attribute\n * @param value - value of the attribute\n */\n public setSharedSpanAttribute(key: string, value: string) {\n this.sharedSpanAttributes[key] = value;\n }\n\n /**\n * Flushes all telemetry and shuts down the telemetry client.\n */\n public async shutdown() {\n this._rootSpan.end();\n await this.appInsightsClient?.flush();\n await this.appInsightsClient?.shutdown();\n }\n\n /**\n * Gets the OpenTelemetry tracer.\n * @returns the OpenTelemetry tracer\n */\n public getTracer(): Tracer {\n return this.appInsightsClient?.getTraceHandler().getTracer();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAppInsightsConfig.d.ts","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"getAppInsightsConfig.d.ts","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AASrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,6BAsC7D"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import Resources from '@opentelemetry/resources';
|
|
2
|
+
import SemanticConventions from '@opentelemetry/semantic-conventions';
|
|
3
3
|
import { ApplicationInsightsConfig } from 'applicationinsights';
|
|
4
4
|
import { createHash } from 'crypto';
|
|
5
5
|
import { getComputerName } from './getComputerName.js';
|
|
6
|
+
const { Resource } = Resources;
|
|
7
|
+
const { SemanticResourceAttributes } = SemanticConventions;
|
|
6
8
|
function sha256(input) {
|
|
7
9
|
return createHash('sha256').update(input).digest('hex');
|
|
8
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,yB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CAAC,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3E,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW;QAC9D,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB;KACzE,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import Resources from '@opentelemetry/resources';\nimport SemanticConventions from '@opentelemetry/semantic-conventions';\nimport { ApplicationInsightsConfig } from 'applicationinsights';\nimport { createHash } from 'crypto';\nimport { getComputerName } from './getComputerName.js';\nimport type { TelemetryOptions } from '../types/TelemetryOptions.js';\n\nconst { Resource } = Resources;\nconst { SemanticResourceAttributes } = SemanticConventions;\n\nfunction sha256(input: string) {\n return createHash('sha256').update(input).digest('hex');\n}\n\nexport function getAppInsightsConfig(options: TelemetryOptions) {\n const config = new ApplicationInsightsConfig();\n config.azureMonitorExporterConfig = {\n ...(config.azureMonitorExporterConfig || {}),\n connectionString: `InstrumentationKey=${options.instrumentationKey}`,\n };\n config.enableAutoCollectExceptions = false;\n config.enableAutoCollectHeartbeat = false;\n config.enableAutoCollectPerformance = false;\n config.enableAutoCollectStandardMetrics = false;\n config.instrumentations = {\n http: {\n enabled: false,\n },\n azureSdk: {\n enabled: false,\n },\n };\n config.logInstrumentations = {\n bunyan: {\n enabled: false,\n },\n console: {\n enabled: false,\n },\n winston: {\n enabled: false,\n },\n };\n\n config.resource = new Resource({\n // Use a hash of the computer name to avoid PII\n [SemanticResourceAttributes.SERVICE_INSTANCE_ID]: sha256(getComputerName()),\n [SemanticResourceAttributes.SERVICE_NAME]: options.serviceName,\n [SemanticResourceAttributes.SERVICE_NAMESPACE]: options.serviceNamespace,\n });\n\n return config;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
1
2
|
import type { TelemetryClient } from '../types/TelemetryClient.js';
|
|
2
3
|
import { NoOpTracer } from './NoOpTracer.js';
|
|
3
4
|
/**
|
|
@@ -5,6 +6,7 @@ import { NoOpTracer } from './NoOpTracer.js';
|
|
|
5
6
|
* This class will be used when Telemetry is disabled.
|
|
6
7
|
*/
|
|
7
8
|
export declare class NoOpTelemetryClient implements TelemetryClient {
|
|
9
|
+
readonly rootSpan: Span;
|
|
8
10
|
private tracer;
|
|
9
11
|
setSharedSpanAttribute(): TelemetryClient;
|
|
10
12
|
shutdown(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoOpTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"NoOpTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAoB;IAElC,sBAAsB,IAAI,eAAe;IAKzC,QAAQ;IAKR,SAAS;CAGV"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { NoOpTracer } from './NoOpTracer.js';
|
|
2
|
+
import { NoOpSpan } from './NoOpSpan.js';
|
|
2
3
|
/**
|
|
3
4
|
* No-op implementation of {@link TelemetryClient}.
|
|
4
5
|
* This class will be used when Telemetry is disabled.
|
|
5
6
|
*/
|
|
6
7
|
export class NoOpTelemetryClient {
|
|
7
8
|
constructor() {
|
|
9
|
+
this.rootSpan = new NoOpSpan();
|
|
8
10
|
this.tracer = new NoOpTracer();
|
|
9
11
|
}
|
|
10
12
|
setSharedSpanAttribute() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoOpTelemetryClient.js","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoOpTelemetryClient.js","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QACW,aAAQ,GAAS,IAAI,QAAQ,EAAE,CAAC;QACjC,WAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAepC,CAAC;IAbC,sBAAsB;QACpB,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,QAAQ;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { TelemetryClient } from '../types/TelemetryClient.js';\nimport { NoOpTracer } from './NoOpTracer.js';\nimport { NoOpSpan } from './NoOpSpan.js';\n\n/**\n * No-op implementation of {@link TelemetryClient}.\n * This class will be used when Telemetry is disabled.\n */\nexport class NoOpTelemetryClient implements TelemetryClient {\n readonly rootSpan: Span = new NoOpSpan();\n private tracer = new NoOpTracer();\n\n setSharedSpanAttribute(): TelemetryClient {\n // No-op\n return this;\n }\n\n shutdown() {\n // No-op\n return Promise.resolve();\n }\n\n getTracer() {\n return this.tracer;\n }\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { createTelemetryClient } from './createTelemetryClient.js';
|
|
|
3
3
|
export type { LogLevel } from './types/LogLevel.js';
|
|
4
4
|
export type { TelemetryClient } from './types/TelemetryClient.js';
|
|
5
5
|
export type { TelemetryOptions } from './types/TelemetryOptions.js';
|
|
6
|
+
export { NoOpTelemetryClient } from './NoOp/NoOpTelemetryClient.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export type { Span, Tracer } from '@opentelemetry/api';\nexport { createTelemetryClient } from './createTelemetryClient.js';\nexport type { LogLevel } from './types/LogLevel.js';\nexport type { TelemetryClient } from './types/TelemetryClient.js';\nexport type { TelemetryOptions } from './types/TelemetryOptions.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAInE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export type { Span, Tracer } from '@opentelemetry/api';\nexport { createTelemetryClient } from './createTelemetryClient.js';\nexport type { LogLevel } from './types/LogLevel.js';\nexport type { TelemetryClient } from './types/TelemetryClient.js';\nexport type { TelemetryOptions } from './types/TelemetryOptions.js';\nexport { NoOpTelemetryClient } from './NoOp/NoOpTelemetryClient.js';\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type { Tracer } from '@opentelemetry/api';
|
|
1
|
+
import type { Span, Tracer } from '@opentelemetry/api';
|
|
2
2
|
export interface TelemetryClient {
|
|
3
|
+
/**
|
|
4
|
+
* Root span which measures the duration of the highest level application (ie: CLI)
|
|
5
|
+
*/
|
|
6
|
+
rootSpan: Span;
|
|
3
7
|
/**
|
|
4
8
|
* Sets a shared attribute that will be added to all spans.
|
|
5
9
|
* @param key - key of the attribute
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TelemetryClient.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"TelemetryClient.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAC;IAEf;;;;OAIG;IACH,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;OAGG;IACH,SAAS,IAAI,MAAM,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TelemetryClient.js","sourceRoot":"","sources":["../../src/types/TelemetryClient.ts"],"names":[],"mappings":"","sourcesContent":["import type { Tracer } from '@opentelemetry/api';\n\nexport interface TelemetryClient {\n /**\n * Sets a shared attribute that will be added to all spans.\n * @param key - key of the attribute\n * @param value - value of the attribute\n */\n setSharedSpanAttribute(key: string, value: string): void;\n\n /**\n * Flushes all telemetry and shuts down the telemetry client.\n */\n shutdown(): Promise<void>;\n\n /**\n * Gets the OpenTelemetry tracer.\n * @returns the OpenTelemetry tracer\n */\n getTracer(): Tracer;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TelemetryClient.js","sourceRoot":"","sources":["../../src/types/TelemetryClient.ts"],"names":[],"mappings":"","sourcesContent":["import type { Span, Tracer } from '@opentelemetry/api';\n\nexport interface TelemetryClient {\n /**\n * Root span which measures the duration of the highest level application (ie: CLI)\n */\n rootSpan: Span;\n\n /**\n * Sets a shared attribute that will be added to all spans.\n * @param key - key of the attribute\n * @param value - value of the attribute\n */\n setSharedSpanAttribute(key: string, value: string): void;\n\n /**\n * Flushes all telemetry and shuts down the telemetry client.\n */\n shutdown(): Promise<void>;\n\n /**\n * Gets the OpenTelemetry tracer.\n * @returns the OpenTelemetry tracer\n */\n getTracer(): Tracer;\n}\n"]}
|
|
@@ -22,5 +22,9 @@ export interface TelemetryOptions {
|
|
|
22
22
|
* Possible values: cli, bundler-service, etc.
|
|
23
23
|
*/
|
|
24
24
|
serviceName: string;
|
|
25
|
+
/**
|
|
26
|
+
* Name of the root span, 'root' will be used as a span name if this property is not set.
|
|
27
|
+
*/
|
|
28
|
+
rootSpanName?: string;
|
|
25
29
|
}
|
|
26
30
|
//# sourceMappingURL=TelemetryOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TelemetryOptions.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"TelemetryOptions.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TelemetryOptions.js","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogLevel } from './LogLevel.js';\n\nexport interface TelemetryOptions {\n /**\n * The instrumentation key for the Application Insights.\n */\n instrumentationKey?: string;\n\n /**\n * The log level for the telemetry client.\n */\n logLevel?: LogLevel;\n\n /**\n * The version of the product. This will be added as a shared attribute to all spans.\n */\n productVersion: string;\n\n /**\n * A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services.\n * Possible values: cloudpack, cloudpack.services, etc.\n */\n serviceNamespace: string;\n\n /**\n * Logic name of the service\n * Possible values: cli, bundler-service, etc.\n */\n serviceName: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TelemetryOptions.js","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogLevel } from './LogLevel.js';\n\nexport interface TelemetryOptions {\n /**\n * The instrumentation key for the Application Insights.\n */\n instrumentationKey?: string;\n\n /**\n * The log level for the telemetry client.\n */\n logLevel?: LogLevel;\n\n /**\n * The version of the product. This will be added as a shared attribute to all spans.\n */\n productVersion: string;\n\n /**\n * A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services.\n * Possible values: cloudpack, cloudpack.services, etc.\n */\n serviceNamespace: string;\n\n /**\n * Logic name of the service\n * Possible values: cli, bundler-service, etc.\n */\n serviceName: string;\n\n /**\n * Name of the root span, 'root' will be used as a span name if this property is not set.\n */\n rootSpanName?: string;\n}\n"]}
|