@ms-cloudpack/telemetry 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppInsightsTelemetryClient-O5Q6NWQ3.js → AppInsightsTelemetryClient-ETNBIAWP.js} +13030 -21027
- package/dist/{NoOpTelemetryClient-UXSLOLXO.js → NoOpTelemetryClient-AODPEX3O.js} +2 -2
- package/dist/chunk-ITZ7GKLO.js +12437 -0
- package/dist/{chunk-M7NO6I7R.js → chunk-MZUZAXPV.js} +12 -19
- package/dist/index.js +4 -4
- package/lib/AppInsightsTelemetryClient.d.ts +6 -0
- package/lib/BaseTelemetryClient.d.ts +30 -0
- package/lib/NoOpTelemetryClient.d.ts +9 -0
- package/lib/PerformanceRecorder.d.ts +2 -3
- package/lib/{AppInsights/SpanEnrichingProcessor.d.ts → SpanEnrichingProcessor.d.ts} +2 -2
- package/lib/{AppInsights/convertLogLevel.d.ts → convertLogLevel.d.ts} +1 -1
- package/lib/{AppInsights/createResourceFromOptions.d.ts → createResourceFromOptions.d.ts} +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/types/MetricEvent.d.ts +2 -2
- package/lib/types/PerformanceTracker.d.ts +2 -2
- package/lib/types/TelemetryClient.d.ts +3 -4
- package/package.json +9 -6
- package/dist/chunk-KAD6FC6G.js +0 -1841
- package/lib/AppInsights/AppInsightsTelemetryClient.d.ts +0 -30
- package/lib/AppInsights/createTraceProvider.d.ts +0 -8
- package/lib/NoOp/NoOpTelemetryClient.d.ts +0 -16
- package/lib/types/SpanAttributes.d.ts +0 -3
- /package/lib/{AppInsights/getComputerName.d.ts → getComputerName.d.ts} +0 -0
|
@@ -5,27 +5,20 @@ const require = topLevelCreateRequire(import.meta.url);
|
|
|
5
5
|
const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
__name
|
|
10
|
-
|
|
11
|
-
trace
|
|
12
|
-
} from "./chunk-KAD6FC6G.js";
|
|
8
|
+
BaseTelemetryClient,
|
|
9
|
+
__name
|
|
10
|
+
} from "./chunk-ITZ7GKLO.js";
|
|
13
11
|
|
|
14
|
-
// src/
|
|
15
|
-
|
|
16
|
-
var _NoOpTelemetryClient = class _NoOpTelemetryClient {
|
|
12
|
+
// src/NoOpTelemetryClient.ts
|
|
13
|
+
var _NoOpTelemetryClient = class _NoOpTelemetryClient extends BaseTelemetryClient {
|
|
17
14
|
constructor() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return Promise.resolve();
|
|
26
|
-
}
|
|
27
|
-
getTracer() {
|
|
28
|
-
return trace.getTracer("no-op");
|
|
15
|
+
super({
|
|
16
|
+
productVersion: "no-op",
|
|
17
|
+
serviceName: "no-op",
|
|
18
|
+
rootSpanName: "no-op",
|
|
19
|
+
serviceNamespace: "no-op",
|
|
20
|
+
logLevel: "NONE"
|
|
21
|
+
});
|
|
29
22
|
}
|
|
30
23
|
};
|
|
31
24
|
__name(_NoOpTelemetryClient, "NoOpTelemetryClient");
|
package/dist/index.js
CHANGED
|
@@ -6,28 +6,28 @@ const __filename = topLevelUrl.fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = topLevelPath.dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
NoOpTelemetryClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MZUZAXPV.js";
|
|
10
10
|
import {
|
|
11
11
|
DiagConsoleLogger,
|
|
12
12
|
DiagLogLevel,
|
|
13
13
|
__name,
|
|
14
14
|
diag,
|
|
15
15
|
init_esm
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ITZ7GKLO.js";
|
|
17
17
|
|
|
18
18
|
// src/createTelemetryClient.ts
|
|
19
19
|
init_esm();
|
|
20
20
|
async function createTelemetryClient(options) {
|
|
21
21
|
if (!options.connectionString) {
|
|
22
22
|
console.debug("No connection string found. Telemetry will not be sent.");
|
|
23
|
-
const { NoOpTelemetryClient: NoOpTelemetryClient2 } = await import("./NoOpTelemetryClient-
|
|
23
|
+
const { NoOpTelemetryClient: NoOpTelemetryClient2 } = await import("./NoOpTelemetryClient-AODPEX3O.js");
|
|
24
24
|
return new NoOpTelemetryClient2();
|
|
25
25
|
}
|
|
26
26
|
diag.setLogger(new DiagConsoleLogger(), {
|
|
27
27
|
logLevel: options.logLevel || DiagLogLevel.WARN,
|
|
28
28
|
suppressOverrideMessage: true
|
|
29
29
|
});
|
|
30
|
-
const { AppInsightsTelemetryClient } = await import("./AppInsightsTelemetryClient-
|
|
30
|
+
const { AppInsightsTelemetryClient } = await import("./AppInsightsTelemetryClient-ETNBIAWP.js");
|
|
31
31
|
return new AppInsightsTelemetryClient(options);
|
|
32
32
|
}
|
|
33
33
|
__name(createTelemetryClient, "createTelemetryClient");
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TelemetryOptions } from './types/TelemetryOptions.js';
|
|
2
|
+
import { BaseTelemetryClient } from './BaseTelemetryClient.js';
|
|
3
|
+
export declare class AppInsightsTelemetryClient extends BaseTelemetryClient {
|
|
4
|
+
constructor(options: TelemetryOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=AppInsightsTelemetryClient.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AttributeValue, type Span, type Tracer } from '@opentelemetry/api';
|
|
2
|
+
import type { TelemetryOptions } from './types/TelemetryOptions.js';
|
|
3
|
+
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
4
|
+
import type { TelemetryClient } from './types/TelemetryClient.js';
|
|
5
|
+
import { PerformanceRecorder } from './PerformanceRecorder.js';
|
|
6
|
+
export declare class BaseTelemetryClient implements TelemetryClient {
|
|
7
|
+
private readonly _performance;
|
|
8
|
+
private readonly _rootSpan;
|
|
9
|
+
private readonly sharedSpanAttributes;
|
|
10
|
+
protected readonly _tracerProvider: NodeTracerProvider;
|
|
11
|
+
constructor(options: TelemetryOptions);
|
|
12
|
+
/**
|
|
13
|
+
* Flushes all telemetry and shuts down the telemetry client.
|
|
14
|
+
*/
|
|
15
|
+
shutdown(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Sets a shared attribute that will be added to all spans.
|
|
18
|
+
* @param key - key of the attribute
|
|
19
|
+
* @param value - value of the attribute
|
|
20
|
+
*/
|
|
21
|
+
setSharedSpanAttribute(key: string, value: AttributeValue): void;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the OpenTelemetry tracer.
|
|
24
|
+
* @returns the OpenTelemetry tracer
|
|
25
|
+
*/
|
|
26
|
+
get tracer(): Tracer;
|
|
27
|
+
get performance(): PerformanceRecorder;
|
|
28
|
+
get rootSpan(): Span;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=BaseTelemetryClient.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseTelemetryClient } from './BaseTelemetryClient.js';
|
|
2
|
+
/**
|
|
3
|
+
* No-op implementation of {@link TelemetryClient}.
|
|
4
|
+
* This class will be used when Telemetry is disabled.
|
|
5
|
+
*/
|
|
6
|
+
export declare class NoOpTelemetryClient extends BaseTelemetryClient {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NoOpTelemetryClient.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Span } from '@opentelemetry/api';
|
|
1
|
+
import type { Attributes, Span } from '@opentelemetry/api';
|
|
2
2
|
import type { PerformanceTracker } from './types/PerformanceTracker.js';
|
|
3
|
-
import type { SpanAttributes } from './types/SpanAttributes.js';
|
|
4
3
|
import type { MetricEventAggregator } from './types/MetricEventAggregator.js';
|
|
5
4
|
/**
|
|
6
5
|
* PerformanceRecorder is a utility class for recording performance metrics into telemetry.
|
|
@@ -24,7 +23,7 @@ export declare class PerformanceRecorder {
|
|
|
24
23
|
record(attributes: {
|
|
25
24
|
name: string;
|
|
26
25
|
value: number;
|
|
27
|
-
additionalProperties?:
|
|
26
|
+
additionalProperties?: Attributes;
|
|
28
27
|
}): void;
|
|
29
28
|
/**
|
|
30
29
|
* Tracks the execution time of a given `execute` function and report it to telemetry.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { Attributes } from '@opentelemetry/api';
|
|
1
2
|
import type { ReadableSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
2
|
-
import type { SpanAttributes } from '../types/SpanAttributes.js';
|
|
3
3
|
/**
|
|
4
4
|
* Span processor that adds shared attributes to all spans.
|
|
5
5
|
*/
|
|
6
6
|
export declare class SpanEnrichingProcessor implements SpanProcessor {
|
|
7
7
|
private getSharedSpanAttributes;
|
|
8
|
-
constructor(getSharedSpanAttributes: () =>
|
|
8
|
+
constructor(getSharedSpanAttributes: () => Attributes);
|
|
9
9
|
forceFlush(): Promise<void>;
|
|
10
10
|
shutdown(): Promise<void>;
|
|
11
11
|
onStart(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DiagLogLevel } from '@opentelemetry/api';
|
|
2
|
-
import type { LogLevel } from '
|
|
2
|
+
import type { LogLevel } from './types/LogLevel.js';
|
|
3
3
|
export declare function convertLogLevel(logLevel?: LogLevel): DiagLogLevel;
|
|
4
4
|
//# sourceMappingURL=convertLogLevel.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Resource } from '@opentelemetry/resources';
|
|
2
|
-
import type { TelemetryOptions } from '
|
|
2
|
+
import type { TelemetryOptions } from './types/TelemetryOptions.js';
|
|
3
3
|
export declare function createResourceFromOptions(options: TelemetryOptions): Resource;
|
|
4
4
|
//# sourceMappingURL=createResourceFromOptions.d.ts.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export type { Span, Tracer } from '@opentelemetry/api';
|
|
1
|
+
export type { Span, Tracer, Attributes, AttributeValue } from '@opentelemetry/api';
|
|
2
2
|
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
6
|
export { createNoOpTelemetryClient } from './createNoOpTelemetryClient.js';
|
|
7
7
|
export type { PerformanceTracker } from './types/PerformanceTracker.js';
|
|
8
|
-
export type { SpanAttributes, SpanAttributeValue } from './types/SpanAttributes.js';
|
|
9
8
|
export type { PerformanceRecorder } from './PerformanceRecorder.js';
|
|
10
9
|
export type { MetricEvent } from './types/MetricEvent.js';
|
|
11
10
|
export type { MetricEventAggregator } from './types/MetricEventAggregator.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Attributes } from '@opentelemetry/api';
|
|
2
2
|
export interface PerformanceTracker {
|
|
3
3
|
name: string;
|
|
4
4
|
startTime: number;
|
|
5
|
-
setProperties(properties:
|
|
5
|
+
setProperties(properties: Attributes): void;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=PerformanceTracker.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Span, Tracer } from '@opentelemetry/api';
|
|
1
|
+
import type { AttributeValue, Span, Tracer } from '@opentelemetry/api';
|
|
2
2
|
import type { PerformanceRecorder } from '../PerformanceRecorder.js';
|
|
3
|
-
import type { SpanAttributeValue } from './SpanAttributes.js';
|
|
4
3
|
export interface TelemetryClient {
|
|
5
4
|
/**
|
|
6
5
|
* Root span which measures the duration of the highest level application (ie: CLI)
|
|
@@ -11,7 +10,7 @@ export interface TelemetryClient {
|
|
|
11
10
|
* @param key - key of the attribute
|
|
12
11
|
* @param value - value of the attribute
|
|
13
12
|
*/
|
|
14
|
-
setSharedSpanAttribute(key: string, value:
|
|
13
|
+
setSharedSpanAttribute(key: string, value: AttributeValue): void;
|
|
15
14
|
/**
|
|
16
15
|
* Flushes all telemetry and shuts down the telemetry client.
|
|
17
16
|
*/
|
|
@@ -20,7 +19,7 @@ export interface TelemetryClient {
|
|
|
20
19
|
* Gets the OpenTelemetry tracer.
|
|
21
20
|
* @returns the OpenTelemetry tracer
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
get tracer(): Tracer;
|
|
24
23
|
/**
|
|
25
24
|
* Gets the performance recorder.
|
|
26
25
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/telemetry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Helpers for reporting telemetry in Cloudpack.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,14 +14,17 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@azure/monitor-opentelemetry-exporter": "1.0.0-beta.
|
|
17
|
+
"@azure/monitor-opentelemetry-exporter": "1.0.0-beta.26",
|
|
18
18
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^10.2.6",
|
|
19
20
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
20
21
|
"@opentelemetry/api": "~1.9.0",
|
|
21
|
-
"@opentelemetry/resources": "~1.
|
|
22
|
-
"@opentelemetry/sdk-trace-base": "~1.
|
|
23
|
-
"@opentelemetry/sdk-trace-node": "~1.
|
|
24
|
-
"@opentelemetry/semantic-conventions": "~1.
|
|
22
|
+
"@opentelemetry/resources": "~1.26.0",
|
|
23
|
+
"@opentelemetry/sdk-trace-base": "~1.26.0",
|
|
24
|
+
"@opentelemetry/sdk-trace-node": "~1.26.0",
|
|
25
|
+
"@opentelemetry/semantic-conventions": "~1.27.0",
|
|
26
|
+
"@types/uuid": "^10.0.0",
|
|
27
|
+
"uuid": "^10.0.0"
|
|
25
28
|
},
|
|
26
29
|
"scripts": {
|
|
27
30
|
"api": "cloudpack-scripts api",
|