@ms-cloudpack/telemetry 0.2.4 → 0.3.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/lib/AppInsights/convertLogLevel.d.ts.map +1 -1
- package/lib/AppInsights/convertLogLevel.js +10 -3
- package/lib/AppInsights/convertLogLevel.js.map +1 -1
- package/lib/createTelemetryClient.d.ts.map +1 -1
- package/lib/createTelemetryClient.js +1 -2
- package/lib/createTelemetryClient.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +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,
|
|
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,CAkBjE"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { DiagLogLevel } from '@opentelemetry/api';
|
|
2
2
|
export function convertLogLevel(logLevel) {
|
|
3
3
|
switch (logLevel) {
|
|
4
|
-
case '
|
|
4
|
+
case 'DEBUG':
|
|
5
5
|
return DiagLogLevel.DEBUG;
|
|
6
|
-
case '
|
|
6
|
+
case 'VERBOSE':
|
|
7
7
|
return DiagLogLevel.VERBOSE;
|
|
8
|
-
case '
|
|
8
|
+
case 'NONE':
|
|
9
9
|
return DiagLogLevel.NONE;
|
|
10
|
+
case 'ERROR':
|
|
11
|
+
return DiagLogLevel.ERROR;
|
|
12
|
+
case 'ALL':
|
|
13
|
+
return DiagLogLevel.ALL;
|
|
14
|
+
case 'INFO':
|
|
15
|
+
return DiagLogLevel.INFO;
|
|
16
|
+
case 'WARN':
|
|
10
17
|
default:
|
|
11
18
|
return DiagLogLevel.WARN;
|
|
12
19
|
}
|
|
@@ -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,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 '
|
|
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,KAAK,OAAO;YACV,OAAO,YAAY,CAAC,KAAK,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,YAAY,CAAC,GAAG,CAAC;QAC1B,KAAK,MAAM;YACT,OAAO,YAAY,CAAC,IAAI,CAAC;QAC3B,KAAK,MAAM,CAAC;QACZ;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 case 'ERROR':\n return DiagLogLevel.ERROR;\n case 'ALL':\n return DiagLogLevel.ALL;\n case 'INFO':\n return DiagLogLevel.INFO;\n case 'WARN':\n default:\n return DiagLogLevel.WARN;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTelemetryClient.d.ts","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createTelemetryClient.d.ts","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"AAAA,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,4 +1,3 @@
|
|
|
1
|
-
import { convertLogLevel } from './AppInsights/convertLogLevel.js';
|
|
2
1
|
export async function createTelemetryClient(options) {
|
|
3
2
|
if (!options.instrumentationKey) {
|
|
4
3
|
console.debug('No connection string found. Telemetry will not be sent.');
|
|
@@ -7,7 +6,7 @@ export async function createTelemetryClient(options) {
|
|
|
7
6
|
return new NoOpTelemetryClient();
|
|
8
7
|
}
|
|
9
8
|
// Set initial log level to WARN to avoid logging telemetry initialization
|
|
10
|
-
process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL =
|
|
9
|
+
process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = options.logLevel || 'WARN';
|
|
11
10
|
// Import TelemetryClient after setting initial log level
|
|
12
11
|
const { AppInsightsTelemetryClient } = await import('./AppInsights/AppInsightsTelemetryClient.js');
|
|
13
12
|
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":"AAEA,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,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE3F,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 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 = options.logLevel || 'WARN';\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/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Tracer } from '@opentelemetry/api';
|
|
2
|
-
export type LogLevel = '
|
|
2
|
+
export type LogLevel = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'VERBOSE' | 'ALL';
|
|
3
3
|
export interface TelemetryClient {
|
|
4
4
|
/**
|
|
5
5
|
* Sets a shared attribute that will be added to all spans.
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;AAExF,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 = '
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Tracer } from '@opentelemetry/api';\n\nexport type LogLevel = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'VERBOSE' | 'ALL';\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"]}
|