@ms-cloudpack/telemetry 0.3.5 → 0.3.6
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.
|
@@ -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"],"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ACF,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 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"]}
|