@ms-cloudpack/telemetry 0.2.2 → 0.2.4
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 +1 -0
- package/lib/AppInsights/AppInsightsTelemetryClient.d.ts.map +1 -0
- package/lib/AppInsights/SpanEnrichingProcessor.d.ts +1 -0
- package/lib/AppInsights/SpanEnrichingProcessor.d.ts.map +1 -0
- package/lib/AppInsights/convertLogLevel.d.ts +1 -0
- package/lib/AppInsights/convertLogLevel.d.ts.map +1 -0
- package/lib/AppInsights/convertLogLevel.js +2 -0
- package/lib/AppInsights/convertLogLevel.js.map +1 -1
- package/lib/AppInsights/getAppInsightsConfig.d.ts +1 -0
- package/lib/AppInsights/getAppInsightsConfig.d.ts.map +1 -0
- package/lib/AppInsights/getComputerName.d.ts +1 -0
- package/lib/AppInsights/getComputerName.d.ts.map +1 -0
- package/lib/NoOp/NoOpSpan.d.ts +1 -0
- package/lib/NoOp/NoOpSpan.d.ts.map +1 -0
- package/lib/NoOp/NoOpTelemetryClient.d.ts +1 -0
- package/lib/NoOp/NoOpTelemetryClient.d.ts.map +1 -0
- package/lib/NoOp/NoOpTracer.d.ts +1 -0
- package/lib/NoOp/NoOpTracer.d.ts.map +1 -0
- package/lib/createTelemetryClient.d.ts +1 -0
- package/lib/createTelemetryClient.d.ts.map +1 -0
- package/lib/createTelemetryClient.js +2 -1
- package/lib/createTelemetryClient.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/types.d.ts +2 -1
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +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;AAMjD,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErE,qBAAa,0BAA2B,YAAW,eAAe;IAChE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;gBAEvD,OAAO,EAAE,gBAAgB;IAiBrC;;;;OAIG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxD;;OAEG;IACU,QAAQ;IAKrB;;;OAGG;IACI,SAAS,IAAI,MAAM;CAG3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpanEnrichingProcessor.d.ts","sourceRoot":"","sources":["../../src/AppInsights/SpanEnrichingProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEjF;;GAEG;AACH,qBAAa,sBAAuB,YAAW,aAAa;IAC9C,OAAO,CAAC,uBAAuB;gBAAvB,uBAAuB,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAEzE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,OAAO,IAAI,IAAI;IAIf,KAAK,CAAC,IAAI,EAAE,YAAY;CAKzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertLogLevel.d.ts","sourceRoot":"","sources":["../../src/AppInsights/convertLogLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY,CAWjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertLogLevel.js","sourceRoot":"","sources":["../../src/AppInsights/convertLogLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,UAAU,eAAe,CAAC,QAAmB;IACjD,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,KAAK,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,YAAY,CAAC,OAAO,CAAC;QAC9B;YACE,OAAO,YAAY,CAAC,IAAI,CAAC;KAC5B;AACH,CAAC","sourcesContent":["import { DiagLogLevel } from '@opentelemetry/api';\nimport type { LogLevel } from '../types.js';\n\nexport function convertLogLevel(logLevel?: LogLevel): DiagLogLevel {\n switch (logLevel) {\n case 'debug':\n return DiagLogLevel.DEBUG;\n case 'verbose':\n return DiagLogLevel.VERBOSE;\n default:\n return DiagLogLevel.WARN;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"convertLogLevel.js","sourceRoot":"","sources":["../../src/AppInsights/convertLogLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,UAAU,eAAe,CAAC,QAAmB;IACjD,QAAQ,QAAQ,EAAE;QAChB,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,KAAK,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,YAAY,CAAC,OAAO,CAAC;QAC9B,KAAK,MAAM;YACT,OAAO,YAAY,CAAC,IAAI,CAAC;QAC3B;YACE,OAAO,YAAY,CAAC,IAAI,CAAC;KAC5B;AACH,CAAC","sourcesContent":["import { DiagLogLevel } from '@opentelemetry/api';\nimport type { LogLevel } from '../types.js';\n\nexport function convertLogLevel(logLevel?: LogLevel): DiagLogLevel {\n switch (logLevel) {\n case 'debug':\n return DiagLogLevel.DEBUG;\n case 'verbose':\n return DiagLogLevel.VERBOSE;\n case 'none':\n return DiagLogLevel.NONE;\n default:\n return DiagLogLevel.WARN;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ApplicationInsightsConfig } from 'applicationinsights';
|
|
2
2
|
import type { TelemetryOptions } from '../types.js';
|
|
3
3
|
export declare function getAppInsightsConfig(options: TelemetryOptions): ApplicationInsightsConfig;
|
|
4
|
+
//# sourceMappingURL=getAppInsightsConfig.d.ts.map
|
|
@@ -0,0 +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,aAAa,CAAC;AAMpD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,6BAmC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getComputerName.d.ts","sourceRoot":"","sources":["../../src/AppInsights/getComputerName.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,WAe9B"}
|
package/lib/NoOp/NoOpSpan.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoOpSpan.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,QAAS,YAAW,IAAI;IACnC,WAAW,IAAI,WAAW;IAQ1B,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,QAAQ,IAAI,IAAI;IAKhB,SAAS,IAAI,IAAI;IAKjB,UAAU,IAAI,IAAI;IAKlB,GAAG,IAAI,IAAI;IAIX,WAAW,IAAI,OAAO;IAItB,eAAe,IAAI,IAAI;CAGxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoOpTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,OAAO,CAAC,MAAM,CAAoB;IAElC,sBAAsB,IAAI,eAAe;IAKzC,QAAQ;IAKR,SAAS;CAGV"}
|
package/lib/NoOp/NoOpTracer.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export declare class NoOpTracer implements Tracer {
|
|
|
9
9
|
startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, _opts: SpanOptions, fn: F): ReturnType<F>;
|
|
10
10
|
startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions, ctx: Context, fn: F): ReturnType<F>;
|
|
11
11
|
}
|
|
12
|
+
//# sourceMappingURL=NoOpTracer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoOpTracer.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG7E;;;GAGG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC,SAAS,IAAI,IAAI;IAIjB,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAC5F,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAChH,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EACrD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,CAAC,GACJ,UAAU,CAAC,CAAC,CAAC;CAqBjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTelemetryClient.d.ts","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEpE,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAe/F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { convertLogLevel } from './AppInsights/convertLogLevel.js';
|
|
1
2
|
export async function createTelemetryClient(options) {
|
|
2
3
|
if (!options.instrumentationKey) {
|
|
3
4
|
console.debug('No connection string found. Telemetry will not be sent.');
|
|
@@ -6,7 +7,7 @@ export async function createTelemetryClient(options) {
|
|
|
6
7
|
return new NoOpTelemetryClient();
|
|
7
8
|
}
|
|
8
9
|
// Set initial log level to WARN to avoid logging telemetry initialization
|
|
9
|
-
process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = options.logLevel
|
|
10
|
+
process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = convertLogLevel(options.logLevel).toString();
|
|
10
11
|
// Import TelemetryClient after setting initial log level
|
|
11
12
|
const { AppInsightsTelemetryClient } = await import('./AppInsights/AppInsightsTelemetryClient.js');
|
|
12
13
|
return new AppInsightsTelemetryClient(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTelemetryClient.js","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTelemetryClient.js","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGnE,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAyB;IACnE,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAEzE,wEAAwE;QACxE,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;QAC9E,OAAO,IAAI,mBAAmB,EAAE,CAAC;KAClC;IAED,0EAA0E;IAC1E,OAAO,CAAC,GAAG,CAAC,iDAAiD,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;IAE7G,yDAAyD;IACzD,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,MAAM,CAAC,6CAA6C,CAAC,CAAC;IACnG,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { convertLogLevel } from './AppInsights/convertLogLevel.js';\nimport type { TelemetryClient, TelemetryOptions } from './types.js';\n\nexport async function createTelemetryClient(options: TelemetryOptions): Promise<TelemetryClient> {\n if (!options.instrumentationKey) {\n console.debug('No connection string found. Telemetry will not be sent.');\n\n // Create a no-op telemetry client if no instrumentation key is provided\n const { NoOpTelemetryClient } = await import('./NoOp/NoOpTelemetryClient.js');\n return new NoOpTelemetryClient();\n }\n\n // Set initial log level to WARN to avoid logging telemetry initialization\n process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = convertLogLevel(options.logLevel).toString();\n\n // Import TelemetryClient after setting initial log level\n const { AppInsightsTelemetryClient } = await import('./AppInsights/AppInsightsTelemetryClient.js');\n return new AppInsightsTelemetryClient(options);\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +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,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Tracer } from '@opentelemetry/api';
|
|
2
|
-
export type LogLevel = 'debug' | 'verbose' | 'default';
|
|
2
|
+
export type LogLevel = 'debug' | 'verbose' | 'none' | 'default';
|
|
3
3
|
export interface TelemetryClient {
|
|
4
4
|
/**
|
|
5
5
|
* Sets a shared attribute that will be added to all spans.
|
|
@@ -41,3 +41,4 @@ export interface TelemetryOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
serviceName: string;
|
|
43
43
|
}
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B;;;;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;AAED,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;CACrB"}
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Tracer } from '@opentelemetry/api';\n\nexport type LogLevel = 'debug' | 'verbose' | 'default';\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\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":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Tracer } from '@opentelemetry/api';\n\nexport type LogLevel = 'debug' | 'verbose' | 'none' | 'default';\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\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"]}
|