@ms-cloudpack/telemetry 0.3.3 → 0.3.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.map +1 -1
- package/lib/AppInsights/AppInsightsTelemetryClient.js.map +1 -1
- package/lib/AppInsights/getAppInsightsConfig.d.ts.map +1 -1
- package/lib/AppInsights/getAppInsightsConfig.js +1 -0
- package/lib/AppInsights/getAppInsightsConfig.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
|
@@ -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,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAMjD,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,iBAAiB,CAA4B;IAC9D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;gBAEvD,OAAO,EAAE,gBAAgB;IAerC;;;;OAIG;IACI,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxD;;OAEG;IACU,QAAQ;IAKrB;;;OAGG;IACI,SAAS,IAAI,MAAM;CAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppInsightsTelemetryClient.js","sourceRoot":"","sources":["../../src/AppInsights/AppInsightsTelemetryClient.ts"],"names":[],"mappings":"
|
|
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;IAIrC,YAAY,OAAyB;QAFpB,yBAAoB,GAA2B,EAAE,CAAC;QAGjE,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAC,iBAAiB,GAAG,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAE/D,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAErF,wBAAwB;QACxB,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QAE/D,mEAAmE;QACnE,MAAM,iBAAiB,GAAuB,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,CAAC,iBAAiB,EAAE,CAAC;QAC3G,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,sBAAsB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClG,CAAC;IAED;;;;OAIG;IACI,sBAAsB,CAAC,GAAW,EAAE,KAAa;QACtD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,MAAM,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC;QACtC,MAAM,IAAI,CAAC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACI,SAAS;QACd,OAAO,IAAI,CAAC,iBAAiB,EAAE,eAAe,EAAE,CAAC,SAAS,EAAE,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { 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 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 = <NodeTracerProvider>this.appInsightsClient.getTraceHandler().getTracerProvider();\n nodeTraceProvider.addSpanProcessor(new SpanEnrichingProcessor(() => this.sharedSpanAttributes));\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 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;AAMrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,
|
|
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;AAMrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,6BAsC7D"}
|
|
@@ -13,6 +13,7 @@ export function getAppInsightsConfig(options) {
|
|
|
13
13
|
connectionString: `InstrumentationKey=${options.instrumentationKey}`,
|
|
14
14
|
};
|
|
15
15
|
config.enableAutoCollectExceptions = false;
|
|
16
|
+
config.enableAutoCollectHeartbeat = false;
|
|
16
17
|
config.enableAutoCollectPerformance = false;
|
|
17
18
|
config.enableAutoCollectStandardMetrics = false;
|
|
18
19
|
config.instrumentations = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;A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@opentelemetry/semantic-conventions';\nimport { ApplicationInsightsConfig } from 'applicationinsights';\nimport { createHash } from 'crypto';\nimport { getComputerName } from './getComputerName.js';\nimport type { TelemetryOptions } from '../types/TelemetryOptions.js';\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.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
|
+
{"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAyB;IAC5D,MAAM,MAAM,GAAG,IAAI,yBAAyB,EAAE,CAAC;IAC/C,MAAM,CAAC,0BAA0B,GAAG;QAClC,GAAG,CAAC,MAAM,CAAC,0BAA0B,IAAI,EAAE,CAAC;QAC5C,gBAAgB,EAAE,sBAAsB,OAAO,CAAC,kBAAkB,EAAE;KACrE,CAAC;IACF,MAAM,CAAC,2BAA2B,GAAG,KAAK,CAAC;IAC3C,MAAM,CAAC,0BAA0B,GAAG,KAAK,CAAC;IAC1C,MAAM,CAAC,4BAA4B,GAAG,KAAK,CAAC;IAC5C,MAAM,CAAC,gCAAgC,GAAG,KAAK,CAAC;IAChD,MAAM,CAAC,gBAAgB,GAAG;QACxB,IAAI,EAAE;YACJ,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,KAAK;SACf;KACF,CAAC;IACF,MAAM,CAAC,mBAAmB,GAAG;QAC3B,MAAM,EAAE;YACN,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE;YACP,OAAO,EAAE,KAAK;SACf;KACF,CAAC;IAEF,MAAM,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC;QAC7B,+CAA+C;QAC/C,CAAC,0BAA0B,CAAC,mBAAmB,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 { Resource } from '@opentelemetry/resources';\nimport { SemanticResourceAttributes } 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\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"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/telemetry",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Helpers for logging tasks to the console.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@opentelemetry/sdk-trace-base": "^1.9.1",
|
|
19
19
|
"@opentelemetry/sdk-trace-node": "^1.9.1",
|
|
20
20
|
"@opentelemetry/semantic-conventions": "^1.9.1",
|
|
21
|
-
"applicationinsights": "
|
|
21
|
+
"applicationinsights": "3.0.0-beta.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@ms-cloudpack/eslint-plugin-internal": "*",
|