@azure/monitor-opentelemetry 1.19.0 → 1.20.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/README.md +7 -3
- package/dist/commonjs/browserSdkLoader/browserSdkLoaderHelper.d.ts.map +1 -1
- package/dist/commonjs/browserSdkLoader/browserSdkLoaderHelper.js +1 -2
- package/dist/commonjs/browserSdkLoader/browserSdkLoaderHelper.js.map +1 -1
- package/dist/commonjs/index.d.ts +2 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +4 -13
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/logs/handler.d.ts.map +1 -1
- package/dist/commonjs/logs/handler.js +4 -3
- package/dist/commonjs/logs/handler.js.map +1 -1
- package/dist/commonjs/metrics/performanceCounters.d.ts +3 -0
- package/dist/commonjs/metrics/performanceCounters.d.ts.map +1 -1
- package/dist/commonjs/metrics/performanceCounters.js +26 -26
- package/dist/commonjs/metrics/performanceCounters.js.map +1 -1
- package/dist/commonjs/metrics/quickpulse/export/sender.d.ts.map +1 -1
- package/dist/commonjs/metrics/quickpulse/export/sender.js +8 -7
- package/dist/commonjs/metrics/quickpulse/export/sender.js.map +1 -1
- package/dist/commonjs/package.json +6 -1
- package/dist/commonjs/shared/config.d.ts +7 -0
- package/dist/commonjs/shared/config.d.ts.map +1 -1
- package/dist/commonjs/shared/config.js +27 -6
- package/dist/commonjs/shared/config.js.map +1 -1
- package/dist/commonjs/traces/handler.d.ts.map +1 -1
- package/dist/commonjs/traces/handler.js +1 -7
- package/dist/commonjs/traces/handler.js.map +1 -1
- package/dist/commonjs/traces/sampler.js +1 -1
- package/dist/commonjs/traces/sampler.js.map +1 -1
- package/dist/commonjs/types.d.ts +11 -2
- package/dist/commonjs/types.d.ts.map +1 -1
- package/dist/commonjs/types.js +1 -1
- package/dist/commonjs/types.js.map +1 -1
- package/dist/commonjs/utils/common.d.ts +24 -0
- package/dist/commonjs/utils/common.d.ts.map +1 -1
- package/dist/commonjs/utils/common.js +47 -0
- package/dist/commonjs/utils/common.js.map +1 -1
- package/dist/commonjs/utils/statsbeat.d.ts.map +1 -1
- package/dist/commonjs/utils/statsbeat.js +3 -1
- package/dist/commonjs/utils/statsbeat.js.map +1 -1
- package/dist/esm/browserSdkLoader/browserSdkLoaderHelper.d.ts.map +1 -1
- package/dist/esm/browserSdkLoader/browserSdkLoaderHelper.js +1 -2
- package/dist/esm/browserSdkLoader/browserSdkLoaderHelper.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logs/handler.d.ts.map +1 -1
- package/dist/esm/logs/handler.js +4 -3
- package/dist/esm/logs/handler.js.map +1 -1
- package/dist/esm/metrics/performanceCounters.d.ts +3 -0
- package/dist/esm/metrics/performanceCounters.d.ts.map +1 -1
- package/dist/esm/metrics/performanceCounters.js +26 -26
- package/dist/esm/metrics/performanceCounters.js.map +1 -1
- package/dist/esm/metrics/quickpulse/export/sender.d.ts.map +1 -1
- package/dist/esm/metrics/quickpulse/export/sender.js +8 -7
- package/dist/esm/metrics/quickpulse/export/sender.js.map +1 -1
- package/dist/esm/package.json +6 -1
- package/dist/esm/shared/config.d.ts +7 -0
- package/dist/esm/shared/config.d.ts.map +1 -1
- package/dist/esm/shared/config.js +28 -7
- package/dist/esm/shared/config.js.map +1 -1
- package/dist/esm/traces/handler.d.ts.map +1 -1
- package/dist/esm/traces/handler.js +1 -7
- package/dist/esm/traces/handler.js.map +1 -1
- package/dist/esm/traces/sampler.js +1 -1
- package/dist/esm/traces/sampler.js.map +1 -1
- package/dist/esm/types.d.ts +11 -2
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/common.d.ts +24 -0
- package/dist/esm/utils/common.d.ts.map +1 -1
- package/dist/esm/utils/common.js +45 -0
- package/dist/esm/utils/common.js.map +1 -1
- package/dist/esm/utils/statsbeat.d.ts.map +1 -1
- package/dist/esm/utils/statsbeat.js +4 -2
- package/dist/esm/utils/statsbeat.js.map +1 -1
- package/package.json +28 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performanceCounters.js","sourceRoot":"","sources":["../../../src/metrics/performanceCounters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AAQzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAKnF,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAC5B,cAAc,CAAmC;IACjD,kBAAkB,GAAG,KAAK,CAAC,CAAC,aAAa;IACzC,aAAa,CAAgB;IAC7B,aAAa,CAA6B;IAC1C,KAAK,CAAQ;IACb,wBAAwB,CAAY;IACpC,gBAAgB,CAAkB;IAClC,wBAAwB,CAAqB;IAC7C,uBAAuB,CAAkB;IACzC,+BAA+B,CAAqB;IACpD,yBAAyB,CAAkB;IAC3C,iCAAiC,CAAqB;IACtD,kBAAkB,CAAkB;IACpC,0BAA0B,CAAqB;IAC/C,0BAA0B,CAAkB;IAC5C,kCAAkC,CAAqB;IACvD,gBAAgB,CA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G,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;QAC5D,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,cAAc,GAAG,SAAS,GAAG,IAAI,CAAC;YACxC,MAAM,UAAU,GAAG,YAAY,GAAG,cAAc,CAAC;YACjD,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG;YACvB,KAAK,EAAE,IAAI,CAAC,mBAAmB;YAC/B,IAAI,EAAE,WAAW;SAClB,CAAC;IACJ,CAAC;CAGF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport os from \"node:os\";\nimport type {\n Histogram,\n Meter,\n ObservableCallback,\n ObservableGauge,\n ObservableResult,\n} from \"@opentelemetry/api\";\nimport { SpanKind, ValueType } from \"@opentelemetry/api\";\nimport type { SdkLogRecord } from \"@opentelemetry/sdk-logs\";\nimport { AzureMonitorMetricExporter } from \"@azure/monitor-opentelemetry-exporter\";\nimport type {\n MeterProviderOptions,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { MeterProvider, PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\";\nimport type { ReadableSpan, TimedEvent } from \"@opentelemetry/sdk-trace-base\";\nimport { PerformanceCounterMetricNames } from \"./types.js\";\nimport { hrTimeToMilliseconds } from \"@opentelemetry/core\";\nimport type { AzureMonitorOpenTelemetryOptions } from \"../types.js\";\nimport { getLogData, isExceptionData } from \"./quickpulse/utils.js\";\nimport type { ExceptionData, TraceData } from \"./quickpulse/types.js\";\nimport { Logger } from \"../shared/logging/logger.js\";\nimport { readAvailableMemory } from \"./utils.js\";\nimport process from \"node:process\";\n\n/**\n * Azure Monitor PerformanceCounter Metrics\n */\nexport class PerformanceCounterMetrics {\n private internalConfig: AzureMonitorOpenTelemetryOptions;\n private collectionInterval = 60000; // 60 seconds\n private meterProvider: MeterProvider;\n private azureExporter: AzureMonitorMetricExporter;\n private meter: Meter;\n private requestDurationHistogram: Histogram;\n private requestRateGauge: ObservableGauge;\n private requestRateGaugeCallback: ObservableCallback;\n private memoryPrivateBytesGauge: ObservableGauge;\n private memoryPrivateBytesGaugeCallback: ObservableCallback;\n private memoryAvailableBytesGauge: ObservableGauge;\n private memoryAvailableBytesGaugeCallback: ObservableCallback;\n private processorTimeGauge: ObservableGauge;\n private processorTimeGaugeCallback: ObservableCallback;\n private processTimeNormalizedGauge: ObservableGauge;\n private processTimeNormalizedGaugeCallback: ObservableCallback;\n private processTimeGauge: ObservableGauge;\n private processTimeGaugeCallback: ObservableCallback;\n private exceptionCountGauge: ObservableGauge;\n private exceptionCountGaugeCallback: ObservableCallback;\n private lastExceptionRate: { count: number; time: number } = { count: 0, time: 0 };\n private totalCount: number = 0;\n private intervalExecutionTime = 0;\n private lastRequestRate: { count: number; time: number; executionInterval: number };\n private lastAppCpuUsage: { user: number; system: number };\n private lastHrtime: number[];\n private lastCpus: {\n model: string;\n speed: number;\n times: { user: number; nice: number; sys: number; idle: number; irq: number };\n }[];\n private lastCpusProcess: {\n model: string;\n speed: number;\n times: { user: number; nice: number; sys: number; idle: number; irq: number };\n }[];\n private totalExceptionCount: number = 0;\n\n /**\n * Creates performance counter instruments.\n * @param options - Distro configuration.\n * @param config - Application Insights configuration.\n */\n constructor(config: AzureMonitorOpenTelemetryOptions, options?: { collectionInterval: number }) {\n this.internalConfig = config;\n this.lastCpus = os.cpus();\n this.lastCpusProcess = os.cpus();\n this.lastAppCpuUsage = process.cpuUsage();\n this.lastHrtime = process.hrtime();\n\n this.lastRequestRate = {\n count: this.totalCount,\n time: +new Date(),\n executionInterval: this.intervalExecutionTime,\n };\n\n this.azureExporter = new AzureMonitorMetricExporter(\n this.internalConfig.azureMonitorExporterOptions,\n );\n const metricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.azureExporter,\n exportIntervalMillis: options?.collectionInterval || this.collectionInterval,\n };\n const meterProviderConfig: MeterProviderOptions = {\n readers: [new PeriodicExportingMetricReader(metricReaderOptions)],\n resource: this.internalConfig.resource,\n };\n this.meterProvider = new MeterProvider(meterProviderConfig);\n this.meter = this.meterProvider.getMeter(\"AzureMonitorPerformanceCountersMeter\");\n\n this.lastRequestRate = { count: 0, time: 0, executionInterval: 0 };\n\n // Create Instruments\n this.requestDurationHistogram = this.meter.createHistogram(\n PerformanceCounterMetricNames.REQUEST_DURATION,\n { valueType: ValueType.DOUBLE },\n );\n this.requestRateGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.REQUEST_RATE,\n {\n description: \"Incoming Requests Average Execution Time\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.memoryPrivateBytesGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PRIVATE_BYTES,\n { description: \"Amount of memory process has used in bytes\", valueType: ValueType.INT },\n );\n this.memoryAvailableBytesGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.AVAILABLE_BYTES,\n { description: \"Amount of available memory in bytes\", valueType: ValueType.INT },\n );\n this.processorTimeGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESSOR_TIME,\n {\n description: \"Processor time as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.processTimeGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESS_TIME_STANDARD,\n {\n description: \"Process CPU usage as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.processTimeNormalizedGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESS_TIME_NORMALIZED,\n {\n description: \"Process CPU usage normalized as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.exceptionCountGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.EXCEPTION_RATE,\n {\n description: \"Exception Rate\",\n valueType: ValueType.DOUBLE,\n },\n );\n\n // Add callbacks\n this.requestRateGaugeCallback = this.getRequestRate.bind(this);\n this.memoryPrivateBytesGaugeCallback = this.getPrivateMemory.bind(this);\n this.memoryAvailableBytesGaugeCallback = this.getAvailableMemory.bind(this);\n this.processorTimeGaugeCallback = this.getProcessorTime.bind(this);\n this.processTimeGaugeCallback = this.getProcessTime.bind(this);\n this.processTimeNormalizedGaugeCallback = this.getNormalizedProcessTime.bind(this);\n this.exceptionCountGaugeCallback = this.getExceptionRate.bind(this);\n\n this.memoryPrivateBytesGauge.addCallback(this.memoryPrivateBytesGaugeCallback);\n this.memoryAvailableBytesGauge.addCallback(this.memoryAvailableBytesGaugeCallback);\n this.processTimeGauge.addCallback(this.processTimeGaugeCallback);\n this.processTimeNormalizedGauge.addCallback(this.processTimeNormalizedGaugeCallback);\n this.processorTimeGauge.addCallback(this.processorTimeGaugeCallback);\n this.requestRateGauge.addCallback(this.requestRateGaugeCallback);\n this.exceptionCountGauge.addCallback(this.exceptionCountGaugeCallback);\n }\n\n /**\n * Shutdown Meter Provider it will return no-op Meters after being called.\n */\n public async shutdown(): Promise<void> {\n return this.meterProvider.shutdown();\n }\n\n /**\n * Force flush Meter Provider.\n */\n public async flush(): Promise<void> {\n return this.meterProvider.forceFlush();\n }\n\n /**\n *Get OpenTelemetry MeterProvider\n */\n public getMeterProvider(): MeterProvider {\n return this.meterProvider;\n }\n\n /**\n * Record Span metrics\n * @internal\n */\n public recordSpan(span: ReadableSpan): void {\n if (span.kind !== SpanKind.SERVER) {\n return;\n }\n this.totalCount++;\n const durationMs = hrTimeToMilliseconds(span.duration);\n this.intervalExecutionTime += durationMs;\n this.requestDurationHistogram.record(durationMs);\n if (span.events) {\n span.events.forEach((event: TimedEvent) => {\n event.attributes = event.attributes || {};\n if (event.name === \"exception\") {\n this.totalExceptionCount++;\n }\n });\n }\n }\n\n /**\n * Record Log metrics\n * @internal\n */\n public recordLog(logRecord: SdkLogRecord): void {\n const columns: TraceData | ExceptionData = getLogData(logRecord);\n if (isExceptionData(columns)) {\n this.totalExceptionCount++;\n }\n }\n\n private getRequestRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalCount - this.lastRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const requestsPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(requestsPerSec);\n }\n this.lastRequestRate = {\n count: this.totalCount,\n time: currentTime,\n executionInterval: this.lastRequestRate.executionInterval,\n };\n }\n\n private getPrivateMemory(observableResult: ObservableResult): void {\n if (process?.memoryUsage) {\n observableResult.observe(process.memoryUsage().rss);\n } else {\n Logger.getInstance().debug(\"Couldn't report Private Memory. Process is not defined.\");\n }\n }\n\n private getAvailableMemory(observableResult: ObservableResult): void {\n observableResult.observe(readAvailableMemory());\n }\n\n private getTotalCombinedCpu(cpus: os.CpuInfo[], lastCpus: os.CpuInfo[]) {\n let totalUser = 0;\n let totalSys = 0;\n let totalNice = 0;\n let totalIdle = 0;\n let totalIrq = 0;\n for (let i = 0; !!cpus && i < cpus.length; i++) {\n const cpu = cpus[i];\n const lastCpu = lastCpus[i];\n const times = cpu.times;\n const lastTimes = lastCpu.times;\n // user cpu time (or) % CPU time spent in user space\n let user = times.user - lastTimes.user;\n user = user > 0 ? user : 0; // Avoid negative values\n totalUser += user;\n // system cpu time (or) % CPU time spent in kernel space\n let sys = times.sys - lastTimes.sys;\n sys = sys > 0 ? sys : 0; // Avoid negative values\n totalSys += sys;\n // user nice cpu time (or) % CPU time spent on low priority processes\n let nice = times.nice - lastTimes.nice;\n nice = nice > 0 ? nice : 0; // Avoid negative values\n totalNice += nice;\n // idle cpu time (or) % CPU time spent idle\n let idle = times.idle - lastTimes.idle;\n idle = idle > 0 ? idle : 0; // Avoid negative values\n totalIdle += idle;\n // irq (or) % CPU time spent servicing/handling hardware interrupts\n let irq = times.irq - lastTimes.irq;\n irq = irq > 0 ? irq : 0; // Avoid negative values\n totalIrq += irq;\n }\n const combinedTotal = totalUser + totalSys + totalNice + totalIdle + totalIrq;\n return {\n combinedTotal: combinedTotal,\n totalUser: totalUser,\n totalIdle: totalIdle,\n };\n }\n\n private getProcessorTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n const cpus = os.cpus();\n if (cpus && cpus.length && this.lastCpus && cpus.length === this.lastCpus.length) {\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpus);\n\n const value =\n cpuTotals.combinedTotal > 0\n ? ((cpuTotals.combinedTotal - cpuTotals.totalIdle) / cpuTotals.combinedTotal) * 100\n : 0;\n observableResult.observe(value);\n }\n this.lastCpus = cpus;\n }\n\n private getNormalizedProcessTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n const cpus = os.cpus();\n if (\n cpus &&\n cpus.length &&\n this.lastCpusProcess &&\n cpus.length === this.lastCpusProcess.length\n ) {\n // Calculate % of total cpu time (user + system) this App Process used (Only supported by node v6.1.0+)\n let appCpuPercent: number | undefined = undefined;\n const appCpuUsage = process.cpuUsage();\n const hrtime = process.hrtime();\n const totalApp =\n appCpuUsage.user -\n this.lastAppCpuUsage.user +\n (appCpuUsage.system - this.lastAppCpuUsage.system) || 0;\n\n if (typeof this.lastHrtime !== \"undefined\" && this.lastHrtime.length === 2) {\n const elapsedTime =\n (hrtime[0] - this.lastHrtime[0]) * 1e6 + (hrtime[1] - this.lastHrtime[1]) / 1e3 || 0; // convert to microseconds\n\n appCpuPercent = (100 * totalApp) / (elapsedTime * cpus.length);\n }\n // Set previous\n this.lastAppCpuUsage = appCpuUsage;\n this.lastHrtime = hrtime;\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpusProcess);\n let value = 0;\n if (appCpuPercent !== undefined) {\n value = appCpuPercent;\n } else {\n value = (cpuTotals.totalUser / cpuTotals.combinedTotal) * 100;\n }\n observableResult.observe(value);\n }\n this.lastCpusProcess = cpus;\n }\n\n private getProcessTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n if (process) {\n const cpus = os.cpus();\n if (\n cpus &&\n cpus.length &&\n this.lastCpusProcess &&\n cpus.length === this.lastCpusProcess.length\n ) {\n // Calculate % of total cpu time (user + system) this App Process used (Only supported by node v6.1.0+)\n let appCpuPercent: number | undefined = undefined;\n const appCpuUsage = process.cpuUsage();\n const hrtime = process.hrtime();\n const totalApp =\n appCpuUsage.user -\n this.lastAppCpuUsage.user +\n (appCpuUsage.system - this.lastAppCpuUsage.system) || 0;\n\n if (typeof this.lastHrtime !== \"undefined\" && this.lastHrtime.length === 2) {\n const elapsedTime =\n (hrtime[0] - this.lastHrtime[0]) * 1e6 + (hrtime[1] - this.lastHrtime[1]) / 1e3 || 0; // convert to microseconds\n appCpuPercent = (100 * totalApp) / elapsedTime;\n }\n // Set previous\n this.lastAppCpuUsage = appCpuUsage;\n this.lastHrtime = hrtime;\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpusProcess);\n let value = 0;\n if (appCpuPercent !== undefined) {\n value = appCpuPercent;\n } else {\n value = (cpuTotals.totalUser / cpuTotals.combinedTotal) * 100;\n }\n observableResult.observe(value);\n }\n this.lastCpusProcess = cpus;\n } else {\n Logger.getInstance().debug(\"Couldn't report process time. Process is not defined.\");\n }\n }\n\n private getExceptionRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalExceptionCount - this.lastExceptionRate.count || 0;\n const elapsedMs = currentTime - this.lastExceptionRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastExceptionRate = {\n count: this.totalExceptionCount,\n time: currentTime,\n };\n }\n\n // TODO: Add Process I/O Rate\n}\n"]}
|
|
1
|
+
{"version":3,"file":"performanceCounters.js","sourceRoot":"","sources":["../../../src/metrics/performanceCounters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,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BAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG;YACvB,KAAK,EAAE,IAAI,CAAC,mBAAmB;YAC/B,IAAI,EAAE,WAAW;SAClB,CAAC;IACJ,CAAC;CAGF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport os from \"node:os\";\nimport type {\n Histogram,\n Meter,\n ObservableCallback,\n ObservableGauge,\n ObservableResult,\n} from \"@opentelemetry/api\";\nimport { SpanKind, ValueType } from \"@opentelemetry/api\";\nimport type { SdkLogRecord } from \"@opentelemetry/sdk-logs\";\nimport { AzureMonitorMetricExporter } from \"@azure/monitor-opentelemetry-exporter\";\nimport type {\n MeterProviderOptions,\n PeriodicExportingMetricReaderOptions,\n} from \"@opentelemetry/sdk-metrics\";\nimport { MeterProvider, PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\";\nimport type { ReadableSpan, TimedEvent } from \"@opentelemetry/sdk-trace-base\";\nimport { PerformanceCounterMetricNames } from \"./types.js\";\nimport { hrTimeToMilliseconds } from \"@opentelemetry/core\";\nimport type { AzureMonitorOpenTelemetryOptions } from \"../types.js\";\nimport { getLogData, isExceptionData } from \"./quickpulse/utils.js\";\nimport type { ExceptionData, TraceData } from \"./quickpulse/types.js\";\nimport { Logger } from \"../shared/logging/logger.js\";\nimport { readAvailableMemory } from \"./utils.js\";\nimport process from \"node:process\";\n\n/**\n * Azure Monitor PerformanceCounter Metrics\n */\nexport class PerformanceCounterMetrics {\n private internalConfig: AzureMonitorOpenTelemetryOptions;\n private collectionInterval = 60000; // 60 seconds\n private meterProvider: MeterProvider;\n private azureExporter: AzureMonitorMetricExporter;\n private meter: Meter;\n private requestDurationHistogram: Histogram;\n private requestRateGauge: ObservableGauge;\n private requestRateGaugeCallback: ObservableCallback;\n private memoryPrivateBytesGauge: ObservableGauge;\n private memoryPrivateBytesGaugeCallback: ObservableCallback;\n private memoryAvailableBytesGauge: ObservableGauge;\n private memoryAvailableBytesGaugeCallback: ObservableCallback;\n private processorTimeGauge: ObservableGauge;\n private processorTimeGaugeCallback: ObservableCallback;\n private processTimeNormalizedGauge: ObservableGauge;\n private processTimeNormalizedGaugeCallback: ObservableCallback;\n private processTimeGauge: ObservableGauge;\n private processTimeGaugeCallback: ObservableCallback;\n private exceptionCountGauge: ObservableGauge;\n private exceptionCountGaugeCallback: ObservableCallback;\n private lastExceptionRate: { count: number; time: number };\n private totalCount: number = 0;\n private intervalExecutionTime = 0;\n private lastRequestRate: { count: number; time: number; executionInterval: number };\n private lastAppCpuUsage: { user: number; system: number };\n private lastHrtime: number[];\n private lastCpus: {\n model: string;\n speed: number;\n times: { user: number; nice: number; sys: number; idle: number; irq: number };\n }[];\n private lastCpusProcess: {\n model: string;\n speed: number;\n times: { user: number; nice: number; sys: number; idle: number; irq: number };\n }[];\n private lastAppCpuUsageNormalized: { user: number; system: number };\n private lastHrtimeNormalized: number[];\n private lastCpusProcessNormalized: {\n model: string;\n speed: number;\n times: { user: number; nice: number; sys: number; idle: number; irq: number };\n }[];\n private totalExceptionCount: number = 0;\n\n /**\n * Creates performance counter instruments.\n * @param options - Distro configuration.\n * @param config - Application Insights configuration.\n */\n constructor(config: AzureMonitorOpenTelemetryOptions, options?: { collectionInterval: number }) {\n this.internalConfig = config;\n this.lastCpus = os.cpus();\n this.lastCpusProcess = os.cpus();\n this.lastAppCpuUsage = process.cpuUsage();\n this.lastHrtime = process.hrtime();\n this.lastCpusProcessNormalized = os.cpus();\n this.lastAppCpuUsageNormalized = process.cpuUsage();\n this.lastHrtimeNormalized = process.hrtime();\n\n this.lastRequestRate = {\n count: this.totalCount,\n time: +new Date(),\n executionInterval: this.intervalExecutionTime,\n };\n this.lastExceptionRate = { count: this.totalExceptionCount, time: +new Date() };\n\n this.azureExporter = new AzureMonitorMetricExporter(\n this.internalConfig.azureMonitorExporterOptions,\n );\n const metricReaderOptions: PeriodicExportingMetricReaderOptions = {\n exporter: this.azureExporter,\n exportIntervalMillis: options?.collectionInterval || this.collectionInterval,\n };\n const meterProviderConfig: MeterProviderOptions = {\n readers: [new PeriodicExportingMetricReader(metricReaderOptions)],\n resource: this.internalConfig.resource,\n };\n this.meterProvider = new MeterProvider(meterProviderConfig);\n this.meter = this.meterProvider.getMeter(\"AzureMonitorPerformanceCountersMeter\");\n\n // Create Instruments\n this.requestDurationHistogram = this.meter.createHistogram(\n PerformanceCounterMetricNames.REQUEST_DURATION,\n { valueType: ValueType.DOUBLE },\n );\n this.requestRateGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.REQUEST_RATE,\n {\n description: \"Incoming Requests Average Execution Time\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.memoryPrivateBytesGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PRIVATE_BYTES,\n { description: \"Amount of memory process has used in bytes\", valueType: ValueType.INT },\n );\n this.memoryAvailableBytesGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.AVAILABLE_BYTES,\n { description: \"Amount of available memory in bytes\", valueType: ValueType.INT },\n );\n this.processorTimeGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESSOR_TIME,\n {\n description: \"Processor time as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.processTimeGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESS_TIME_STANDARD,\n {\n description: \"Process CPU usage as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.processTimeNormalizedGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.PROCESS_TIME_NORMALIZED,\n {\n description: \"Process CPU usage normalized as a percentage\",\n valueType: ValueType.DOUBLE,\n },\n );\n this.exceptionCountGauge = this.meter.createObservableGauge(\n PerformanceCounterMetricNames.EXCEPTION_RATE,\n {\n description: \"Exception Rate\",\n valueType: ValueType.DOUBLE,\n },\n );\n\n // Add callbacks\n this.requestRateGaugeCallback = this.getRequestRate.bind(this);\n this.memoryPrivateBytesGaugeCallback = this.getPrivateMemory.bind(this);\n this.memoryAvailableBytesGaugeCallback = this.getAvailableMemory.bind(this);\n this.processorTimeGaugeCallback = this.getProcessorTime.bind(this);\n this.processTimeGaugeCallback = this.getProcessTime.bind(this);\n this.processTimeNormalizedGaugeCallback = this.getNormalizedProcessTime.bind(this);\n this.exceptionCountGaugeCallback = this.getExceptionRate.bind(this);\n\n this.memoryPrivateBytesGauge.addCallback(this.memoryPrivateBytesGaugeCallback);\n this.memoryAvailableBytesGauge.addCallback(this.memoryAvailableBytesGaugeCallback);\n this.processTimeGauge.addCallback(this.processTimeGaugeCallback);\n this.processTimeNormalizedGauge.addCallback(this.processTimeNormalizedGaugeCallback);\n this.processorTimeGauge.addCallback(this.processorTimeGaugeCallback);\n this.requestRateGauge.addCallback(this.requestRateGaugeCallback);\n this.exceptionCountGauge.addCallback(this.exceptionCountGaugeCallback);\n }\n\n /**\n * Shutdown Meter Provider it will return no-op Meters after being called.\n */\n public async shutdown(): Promise<void> {\n return this.meterProvider.shutdown();\n }\n\n /**\n * Force flush Meter Provider.\n */\n public async flush(): Promise<void> {\n return this.meterProvider.forceFlush();\n }\n\n /**\n *Get OpenTelemetry MeterProvider\n */\n public getMeterProvider(): MeterProvider {\n return this.meterProvider;\n }\n\n /**\n * Record Span metrics\n * @internal\n */\n public recordSpan(span: ReadableSpan): void {\n if (span.kind !== SpanKind.SERVER) {\n return;\n }\n this.totalCount++;\n const durationMs = hrTimeToMilliseconds(span.duration);\n this.intervalExecutionTime += durationMs;\n this.requestDurationHistogram.record(durationMs);\n if (span.events) {\n span.events.forEach((event: TimedEvent) => {\n event.attributes = event.attributes || {};\n if (event.name === \"exception\") {\n this.totalExceptionCount++;\n }\n });\n }\n }\n\n /**\n * Record Log metrics\n * @internal\n */\n public recordLog(logRecord: SdkLogRecord): void {\n const columns: TraceData | ExceptionData = getLogData(logRecord);\n if (isExceptionData(columns)) {\n this.totalExceptionCount++;\n }\n }\n\n private getRequestRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalRequests = this.totalCount - this.lastRequestRate.count || 0;\n const elapsedMs = currentTime - this.lastRequestRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const requestsPerSec = intervalRequests / elapsedSeconds;\n observableResult.observe(requestsPerSec);\n }\n this.lastRequestRate = {\n count: this.totalCount,\n time: currentTime,\n executionInterval: this.lastRequestRate.executionInterval,\n };\n }\n\n private getPrivateMemory(observableResult: ObservableResult): void {\n if (process?.memoryUsage) {\n observableResult.observe(process.memoryUsage().rss);\n } else {\n Logger.getInstance().debug(\"Couldn't report Private Memory. Process is not defined.\");\n }\n }\n\n private getAvailableMemory(observableResult: ObservableResult): void {\n observableResult.observe(readAvailableMemory());\n }\n\n private getTotalCombinedCpu(cpus: os.CpuInfo[], lastCpus: os.CpuInfo[]) {\n let totalUser = 0;\n let totalSys = 0;\n let totalNice = 0;\n let totalIdle = 0;\n let totalIrq = 0;\n for (let i = 0; !!cpus && i < cpus.length; i++) {\n const cpu = cpus[i];\n const lastCpu = lastCpus[i];\n const times = cpu.times;\n const lastTimes = lastCpu.times;\n // user cpu time (or) % CPU time spent in user space\n let user = times.user - lastTimes.user;\n user = user > 0 ? user : 0; // Avoid negative values\n totalUser += user;\n // system cpu time (or) % CPU time spent in kernel space\n let sys = times.sys - lastTimes.sys;\n sys = sys > 0 ? sys : 0; // Avoid negative values\n totalSys += sys;\n // user nice cpu time (or) % CPU time spent on low priority processes\n let nice = times.nice - lastTimes.nice;\n nice = nice > 0 ? nice : 0; // Avoid negative values\n totalNice += nice;\n // idle cpu time (or) % CPU time spent idle\n let idle = times.idle - lastTimes.idle;\n idle = idle > 0 ? idle : 0; // Avoid negative values\n totalIdle += idle;\n // irq (or) % CPU time spent servicing/handling hardware interrupts\n let irq = times.irq - lastTimes.irq;\n irq = irq > 0 ? irq : 0; // Avoid negative values\n totalIrq += irq;\n }\n const combinedTotal = totalUser + totalSys + totalNice + totalIdle + totalIrq;\n return {\n combinedTotal: combinedTotal,\n totalUser: totalUser,\n totalIdle: totalIdle,\n };\n }\n\n private getProcessorTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n const cpus = os.cpus();\n if (cpus && cpus.length && this.lastCpus && cpus.length === this.lastCpus.length) {\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpus);\n\n const value =\n cpuTotals.combinedTotal > 0\n ? ((cpuTotals.combinedTotal - cpuTotals.totalIdle) / cpuTotals.combinedTotal) * 100\n : 0;\n observableResult.observe(value);\n }\n this.lastCpus = cpus;\n }\n\n private getNormalizedProcessTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n const cpus = os.cpus();\n if (\n cpus &&\n cpus.length &&\n this.lastCpusProcessNormalized &&\n cpus.length === this.lastCpusProcessNormalized.length\n ) {\n // Calculate % of total cpu time (user + system) this App Process used (Only supported by node v6.1.0+)\n let appCpuPercent: number | undefined = undefined;\n const appCpuUsage = process.cpuUsage();\n const hrtime = process.hrtime();\n const totalApp =\n appCpuUsage.user -\n this.lastAppCpuUsageNormalized.user +\n (appCpuUsage.system - this.lastAppCpuUsageNormalized.system) || 0;\n\n if (\n typeof this.lastHrtimeNormalized !== \"undefined\" &&\n this.lastHrtimeNormalized.length === 2\n ) {\n const elapsedTime =\n (hrtime[0] - this.lastHrtimeNormalized[0]) * 1e6 +\n (hrtime[1] - this.lastHrtimeNormalized[1]) / 1e3 || 0; // convert to microseconds\n\n appCpuPercent = (100 * totalApp) / (elapsedTime * cpus.length);\n }\n // Set previous\n this.lastAppCpuUsageNormalized = appCpuUsage;\n this.lastHrtimeNormalized = hrtime;\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpusProcessNormalized);\n const value =\n appCpuPercent !== undefined\n ? appCpuPercent\n : (cpuTotals.totalUser / cpuTotals.combinedTotal) * 100;\n observableResult.observe(value);\n }\n this.lastCpusProcessNormalized = cpus;\n }\n\n private getProcessTime(observableResult: ObservableResult): void {\n // this reports total ms spent in each category since the OS was booted, to calculate percent it is necessary\n // to find the delta since the last measurement\n if (process) {\n const cpus = os.cpus();\n if (\n cpus &&\n cpus.length &&\n this.lastCpusProcess &&\n cpus.length === this.lastCpusProcess.length\n ) {\n // Calculate % of total cpu time (user + system) this App Process used (Only supported by node v6.1.0+)\n let appCpuPercent: number | undefined = undefined;\n const appCpuUsage = process.cpuUsage();\n const hrtime = process.hrtime();\n const totalApp =\n appCpuUsage.user -\n this.lastAppCpuUsage.user +\n (appCpuUsage.system - this.lastAppCpuUsage.system) || 0;\n\n if (typeof this.lastHrtime !== \"undefined\" && this.lastHrtime.length === 2) {\n const elapsedTime =\n (hrtime[0] - this.lastHrtime[0]) * 1e6 + (hrtime[1] - this.lastHrtime[1]) / 1e3 || 0; // convert to microseconds\n appCpuPercent = (100 * totalApp) / elapsedTime;\n }\n // Set previous\n this.lastAppCpuUsage = appCpuUsage;\n this.lastHrtime = hrtime;\n const cpuTotals = this.getTotalCombinedCpu(cpus, this.lastCpusProcess);\n const value =\n appCpuPercent !== undefined\n ? appCpuPercent\n : (cpuTotals.totalUser / cpuTotals.combinedTotal) * 100;\n observableResult.observe(value);\n }\n this.lastCpusProcess = cpus;\n } else {\n Logger.getInstance().debug(\"Couldn't report process time. Process is not defined.\");\n }\n }\n\n private getExceptionRate(observableResult: ObservableResult): void {\n const currentTime = +new Date();\n const intervalData = this.totalExceptionCount - this.lastExceptionRate.count || 0;\n const elapsedMs = currentTime - this.lastExceptionRate.time;\n if (elapsedMs > 0) {\n const elapsedSeconds = elapsedMs / 1000;\n const dataPerSec = intervalData / elapsedSeconds;\n observableResult.observe(dataPerSec);\n }\n this.lastExceptionRate = {\n count: this.totalExceptionCount,\n time: currentTime,\n };\n }\n\n // TODO: Add Process I/O Rate\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sender.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/quickpulse/export/sender.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EAErB,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAMrC;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,2BAA2B;IACrE,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0BAA0B;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,6CAA6C;IAC7C,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,yCAAyC;IACzC,+BAA+B,CAAC,EAAE,MAAM,CAAC;CAC1C;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,gBAAgB,CAAW;gBAEvB,OAAO,EAAE;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE,eAAe,CAAC;QAC7B,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KACtC;IAyBD,OAAO,CAAC,sBAAsB;IAO9B;;;OAGG;IACG,YAAY,CAChB,cAAc,EAAE,0BAA0B,GACzC,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAuB1C;;;OAGG;IACG,OAAO,CAAC,cAAc,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;IAqB7F;;;;;;;;;OASG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"sender.d.ts","sourceRoot":"","sources":["../../../../../src/metrics/quickpul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
return;
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
const currentHost = (() => {
|
|
122
|
+
try {
|
|
123
|
+
return new url.URL(this.endpointUrl).host;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return "";
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
128
129
|
if (!isSameRegisteredDomain(currentHost, locUrl.host)) {
|
|
129
130
|
diag.error(`Refusing cross-origin Live Metrics redirect to https://${locUrl.host}: target is neither the configured endpoint host nor under a known Azure Monitor ingestion domain.`);
|
|
130
131
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sender.js","sourceRoot":"","sources":["../../../../../src/metrics/quickpulse/export/sender.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAO1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,2BAA2B,GAAG,oCAAoC,CAAC;AAiBzE;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACnB,gBAAgB,CAAmB;IACnC,kBAAkB,CAAS;IAC3B,WAAW,CAAS;IACpB,UAAU,CAAkB;IAC5B,gBAAgB,CAAW;IAEnC,YAAY,OAKX;QACC,gEAAgE;QAChE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,MAAM,aAAa,GAAmC;YACpD,QAAQ,EAAE,IAAI,CAAC,WAAW;SAC3B,CAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAA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GAAG,CAAC,QAAQ,CAAC,CAAC;YACjC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO;YACT,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,IAAI,WAAW,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC;gBACH,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YACnD,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW,GAAG,EAAE,CAAC;YACnB,CAAC;YAED,IAAI,CAAC,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtD,IAAI,CAAC,KAAK,CACR,0DAA0D,MAAM,CAAC,IAAI,oGAAoG,CAC1K,CAAC;gBACF,OAAO;YACT,CAAC;YAED,IAAI,CAAC,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;YAC5C,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC;gBAClD,QAAQ,EAAE,IAAI,CAAC,WAAW;gBAC1B,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE;aAC/C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport url from \"url\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\nimport { redirectPolicyName } from \"@azure/core-rest-pipeline\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { diag } from \"@opentelemetry/api\";\nimport type {\n IsSubscribedOptionalParams,\n PublishOptionalParams,\n QuickpulseClientOptionalParams,\n CollectionConfigurationInfo,\n} from \"../../../generated/index.js\";\nimport { QuickpulseClient } from \"../../../generated/index.js\";\nimport { isSameRegisteredDomain } from \"../redirectUtils.js\";\n\nconst applicationInsightsResource = \"https://monitor.azure.com/.default\";\n\n/**\n * Response type that includes the body and response headers from the Live Metrics service.\n * @internal\n */\nexport interface QuickpulseResponse extends CollectionConfigurationInfo {\n /** Whether the instrumentation key is subscribed. */\n xMsQpsSubscribed?: string;\n /** Configuration ETag. */\n xMsQpsConfigurationEtag?: string;\n /** Polling interval hint (only for ping). */\n xMsQpsServicePollingIntervalHint?: string;\n /** Endpoint redirect (only for ping). */\n xMsQpsServiceEndpointRedirectV2?: string;\n}\n\n/**\n * Quickpulse sender class\n * @internal\n */\nexport class QuickpulseSender {\n private quickpulseClient: QuickpulseClient;\n private instrumentationKey: string;\n private endpointUrl: string;\n private credential: TokenCredential;\n private credentialScopes: string[];\n\n constructor(options: {\n endpointUrl: string;\n instrumentationKey: string;\n credential?: TokenCredential;\n credentialScopes?: string | string[];\n }) {\n // Build endpoint using provided configuration or default values\n this.endpointUrl = options.endpointUrl;\n const clientOptions: QuickpulseClientOptionalParams = {\n endpoint: this.endpointUrl,\n };\n\n this.instrumentationKey = options.instrumentationKey;\n this.credential = options.credential as TokenCredential;\n\n // Configure credential scopes\n if (options.credentialScopes) {\n this.credentialScopes = Array.isArray(options.credentialScopes)\n ? options.credentialScopes\n : [options.credentialScopes];\n } else {\n this.credentialScopes = [applicationInsightsResource];\n }\n if (options.credential) {\n clientOptions.credentials = { scopes: this.credentialScopes };\n }\n\n this.quickpulseClient = this.createQuickpulseClient(clientOptions);\n }\n\n private createQuickpulseClient(clientOptions: QuickpulseClientOptionalParams): QuickpulseClient {\n const client = new QuickpulseClient(this.credential, clientOptions);\n // Handle redirects in HTTP Sender\n client.pipeline.removePolicy({ name: redirectPolicyName });\n return client;\n }\n\n /**\n * isSubscribed Quickpulse service\n * @internal\n */\n async isSubscribed(\n optionalParams: IsSubscribedOptionalParams,\n ): Promise<QuickpulseResponse | undefined> {\n try {\n let responseHeaders: Record<string, string> = {};\n const body = await this.quickpulseClient.isSubscribed(this.instrumentationKey, {\n ...optionalParams,\n onResponse: (rawResponse) => {\n responseHeaders = rawResponse.headers.toJSON();\n },\n });\n return {\n ...body,\n xMsQpsSubscribed: responseHeaders[\"x-ms-qps-subscribed\"],\n xMsQpsConfigurationEtag: responseHeaders[\"x-ms-qps-configuration-etag\"],\n xMsQpsServicePollingIntervalHint: responseHeaders[\"x-ms-qps-service-polling-interval-hint\"],\n xMsQpsServiceEndpointRedirectV2: responseHeaders[\"x-ms-qps-service-endpoint-redirect-v2\"],\n };\n } catch (error: any) {\n const restError = error as RestError;\n diag.info(\"Failed to ping Quickpulse service\", restError.message);\n }\n return;\n }\n\n /**\n * publish Quickpulse service\n * @internal\n */\n async publish(optionalParams: PublishOptionalParams): Promise<QuickpulseResponse | undefined> {\n try {\n let responseHeaders: Record<string, string> = {};\n const body = await this.quickpulseClient.publish(this.instrumentationKey, {\n ...optionalParams,\n onResponse: (rawResponse) => {\n responseHeaders = rawResponse.headers.toJSON();\n },\n });\n return {\n ...body,\n xMsQpsSubscribed: responseHeaders[\"x-ms-qps-subscribed\"],\n xMsQpsConfigurationEtag: responseHeaders[\"x-ms-qps-configuration-etag\"],\n };\n } catch (error: any) {\n const restError = error as RestError;\n diag.warn(\"Failed to post Quickpulse service\", restError.message);\n }\n return;\n }\n\n /**\n * Apply a server-issued Live Metrics redirect (`x-ms-qps-service-endpoint-redirect-v2`) by\n * re-pointing the underlying client at the new host.\n *\n * Cross-origin redirects are refused (no state mutated) when the target is neither the configured\n * Live Metrics host nor under a known Azure Monitor ingestion domain suffix. Refusing them is\n * required to prevent an attacker-controlled redirect from causing the bearer auth policy to\n * attach a freshly-signed AAD token (scope `https://monitor.azure.com/.default`) — and the\n * telemetry body — to a foreign host on the next ping/publish call.\n */\n handlePermanentRedirect(location: string | undefined): void {\n if (location) {\n let locUrl: url.URL;\n try {\n locUrl = new url.URL(location);\n } catch {\n return;\n }\n if (!locUrl.host) {\n return;\n }\n\n let currentHost = \"\";\n try {\n currentHost = new url.URL(this.endpointUrl).host;\n } catch {\n currentHost = \"\";\n }\n\n if (!isSameRegisteredDomain(currentHost, locUrl.host)) {\n diag.error(\n `Refusing cross-origin Live Metrics redirect to https://${locUrl.host}: target is neither the configured endpoint host nor under a known Azure Monitor ingestion domain.`,\n );\n return;\n }\n\n this.endpointUrl = \"https://\" + locUrl.host;\n // Recreate the client so subsequent requests use the new endpoint\n this.quickpulseClient = this.createQuickpulseClient({\n endpoint: this.endpointUrl,\n credentials: { scopes: this.credentialScopes },\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sender.js","sourceRoot":"","sources":["../../../../../src/metrics/quickpulse/export/sender.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAO1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,2BAA2B,GAAG,oCAAoC,CAAC;AAiBzE;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACnB,gBAAgB,CAAmB;IACnC,kBAAkB,CAAS;IAC3B,WAAW,CAAS;IACpB,UAAU,CAAkB;IAC5B,gBAAgB,CAAW;IAEnC,YAAY,OAKX;QACC,gEAAgE;QAChE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,MAAM,aAAa,GAAmC;YACpD,QAAQ,EAAE,IAAI,CAAC,WAAW;SAC3B,CAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAA6B,CAAC;QAExD,8BAA8B;QAC9B,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,OA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MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;gBACxB,IAAI,CAAC;oBACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;gBAC5C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,EAAE,CAAC;YAEL,IAAI,CAAC,sBAAsB,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtD,IAAI,CAAC,KAAK,CACR,0DAA0D,MAAM,CAAC,IAAI,oGAAoG,CAC1K,CAAC;gBACF,OAAO;YACT,CAAC;YAED,IAAI,CAAC,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;YAC5C,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC;gBAClD,QAAQ,EAAE,IAAI,CAAC,WAAW;gBAC1B,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE;aAC/C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport url from \"url\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\nimport { redirectPolicyName } from \"@azure/core-rest-pipeline\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { diag } from \"@opentelemetry/api\";\nimport type {\n IsSubscribedOptionalParams,\n PublishOptionalParams,\n QuickpulseClientOptionalParams,\n CollectionConfigurationInfo,\n} from \"../../../generated/index.js\";\nimport { QuickpulseClient } from \"../../../generated/index.js\";\nimport { isSameRegisteredDomain } from \"../redirectUtils.js\";\n\nconst applicationInsightsResource = \"https://monitor.azure.com/.default\";\n\n/**\n * Response type that includes the body and response headers from the Live Metrics service.\n * @internal\n */\nexport interface QuickpulseResponse extends CollectionConfigurationInfo {\n /** Whether the instrumentation key is subscribed. */\n xMsQpsSubscribed?: string;\n /** Configuration ETag. */\n xMsQpsConfigurationEtag?: string;\n /** Polling interval hint (only for ping). */\n xMsQpsServicePollingIntervalHint?: string;\n /** Endpoint redirect (only for ping). */\n xMsQpsServiceEndpointRedirectV2?: string;\n}\n\n/**\n * Quickpulse sender class\n * @internal\n */\nexport class QuickpulseSender {\n private quickpulseClient: QuickpulseClient;\n private instrumentationKey: string;\n private endpointUrl: string;\n private credential: TokenCredential;\n private credentialScopes: string[];\n\n constructor(options: {\n endpointUrl: string;\n instrumentationKey: string;\n credential?: TokenCredential;\n credentialScopes?: string | string[];\n }) {\n // Build endpoint using provided configuration or default values\n this.endpointUrl = options.endpointUrl;\n const clientOptions: QuickpulseClientOptionalParams = {\n endpoint: this.endpointUrl,\n };\n\n this.instrumentationKey = options.instrumentationKey;\n this.credential = options.credential as TokenCredential;\n\n // Configure credential scopes\n if (options.credentialScopes) {\n this.credentialScopes = Array.isArray(options.credentialScopes)\n ? options.credentialScopes\n : [options.credentialScopes];\n } else {\n this.credentialScopes = [applicationInsightsResource];\n }\n if (options.credential) {\n clientOptions.credentials = { scopes: this.credentialScopes };\n }\n\n this.quickpulseClient = this.createQuickpulseClient(clientOptions);\n }\n\n private createQuickpulseClient(clientOptions: QuickpulseClientOptionalParams): QuickpulseClient {\n const client = new QuickpulseClient(this.credential, clientOptions);\n // Handle redirects in HTTP Sender\n client.pipeline.removePolicy({ name: redirectPolicyName });\n return client;\n }\n\n /**\n * isSubscribed Quickpulse service\n * @internal\n */\n async isSubscribed(\n optionalParams: IsSubscribedOptionalParams,\n ): Promise<QuickpulseResponse | undefined> {\n try {\n let responseHeaders: Record<string, string> = {};\n const body = await this.quickpulseClient.isSubscribed(this.instrumentationKey, {\n ...optionalParams,\n onResponse: (rawResponse) => {\n responseHeaders = rawResponse.headers.toJSON();\n },\n });\n return {\n ...body,\n xMsQpsSubscribed: responseHeaders[\"x-ms-qps-subscribed\"],\n xMsQpsConfigurationEtag: responseHeaders[\"x-ms-qps-configuration-etag\"],\n xMsQpsServicePollingIntervalHint: responseHeaders[\"x-ms-qps-service-polling-interval-hint\"],\n xMsQpsServiceEndpointRedirectV2: responseHeaders[\"x-ms-qps-service-endpoint-redirect-v2\"],\n };\n } catch (error: any) {\n const restError = error as RestError;\n diag.info(\"Failed to ping Quickpulse service\", restError.message);\n }\n return;\n }\n\n /**\n * publish Quickpulse service\n * @internal\n */\n async publish(optionalParams: PublishOptionalParams): Promise<QuickpulseResponse | undefined> {\n try {\n let responseHeaders: Record<string, string> = {};\n const body = await this.quickpulseClient.publish(this.instrumentationKey, {\n ...optionalParams,\n onResponse: (rawResponse) => {\n responseHeaders = rawResponse.headers.toJSON();\n },\n });\n return {\n ...body,\n xMsQpsSubscribed: responseHeaders[\"x-ms-qps-subscribed\"],\n xMsQpsConfigurationEtag: responseHeaders[\"x-ms-qps-configuration-etag\"],\n };\n } catch (error: any) {\n const restError = error as RestError;\n diag.warn(\"Failed to post Quickpulse service\", restError.message);\n }\n return;\n }\n\n /**\n * Apply a server-issued Live Metrics redirect (`x-ms-qps-service-endpoint-redirect-v2`) by\n * re-pointing the underlying client at the new host.\n *\n * Cross-origin redirects are refused (no state mutated) when the target is neither the configured\n * Live Metrics host nor under a known Azure Monitor ingestion domain suffix. Refusing them is\n * required to prevent an attacker-controlled redirect from causing the bearer auth policy to\n * attach a freshly-signed AAD token (scope `https://monitor.azure.com/.default`) — and the\n * telemetry body — to a foreign host on the next ping/publish call.\n */\n handlePermanentRedirect(location: string | undefined): void {\n if (location) {\n let locUrl: url.URL;\n try {\n locUrl = new url.URL(location);\n } catch {\n return;\n }\n if (!locUrl.host) {\n return;\n }\n\n const currentHost = (() => {\n try {\n return new url.URL(this.endpointUrl).host;\n } catch {\n return \"\";\n }\n })();\n\n if (!isSameRegisteredDomain(currentHost, locUrl.host)) {\n diag.error(\n `Refusing cross-origin Live Metrics redirect to https://${locUrl.host}: target is neither the configured endpoint host nor under a known Azure Monitor ingestion domain.`,\n );\n return;\n }\n\n this.endpointUrl = \"https://\" + locUrl.host;\n // Recreate the client so subsequent requests use the new endpoint\n this.quickpulseClient = this.createQuickpulseClient({\n endpoint: this.endpointUrl,\n credentials: { scopes: this.credentialScopes },\n });\n }\n }\n}\n"]}
|
package/dist/esm/package.json
CHANGED
|
@@ -29,11 +29,18 @@ export declare class InternalConfig implements AzureMonitorOpenTelemetryOptions
|
|
|
29
29
|
/** Custom OpenTelemetry sampler (env-only) */
|
|
30
30
|
sampler?: Sampler;
|
|
31
31
|
private _resource;
|
|
32
|
+
private _aksResourceDetectorPopulated;
|
|
32
33
|
set resource(resource: Resource);
|
|
33
34
|
/**
|
|
34
35
|
*Get OpenTelemetry Resource
|
|
35
36
|
*/
|
|
36
37
|
get resource(): Resource;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the AKS resource detector was able to populate the AKS cluster attributes, which
|
|
40
|
+
* requires the customer to have configured access to the `aks-cluster-metadata` ConfigMap.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
get aksResourceDetectorPopulated(): boolean;
|
|
37
44
|
browserSdkLoaderOptions: BrowserSdkLoaderOptions;
|
|
38
45
|
/**
|
|
39
46
|
* Initializes a new instance of the AzureMonitorOpenTelemetryOptions class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/shared/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA2B,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAOlF,OAAO,KAAK,EACV,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/shared/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA2B,QAAQ,E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AAO,CAAC,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;CAmBvF"}
|
|
@@ -4,7 +4,9 @@ import { defaultResource, detectResources, emptyResource, envDetector, } from "@
|
|
|
4
4
|
import { EnvConfig } from "./envConfig.js";
|
|
5
5
|
import { JsonConfig } from "./jsonConfig.js";
|
|
6
6
|
import { Logger } from "./logging/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { isAksResourceDetectorPopulated } from "../utils/common.js";
|
|
8
|
+
import { azureAksDetector, azureAppServiceDetector, azureContainerAppsDetector, azureFunctionsDetector, azureVmDetector, } from "@opentelemetry/resource-detector-azure";
|
|
9
|
+
import { SEMRESATTRS_CLOUD_PLATFORM } from "@opentelemetry/semantic-conventions";
|
|
8
10
|
/**
|
|
9
11
|
* Azure Monitor OpenTelemetry Client Configuration
|
|
10
12
|
*/
|
|
@@ -32,6 +34,7 @@ export class InternalConfig {
|
|
|
32
34
|
/** Custom OpenTelemetry sampler (env-only) */
|
|
33
35
|
sampler;
|
|
34
36
|
_resource = emptyResource();
|
|
37
|
+
_aksResourceDetectorPopulated = false;
|
|
35
38
|
set resource(resource) {
|
|
36
39
|
this._resource = this._resource.merge(resource);
|
|
37
40
|
}
|
|
@@ -41,6 +44,14 @@ export class InternalConfig {
|
|
|
41
44
|
get resource() {
|
|
42
45
|
return this._resource;
|
|
43
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether the AKS resource detector was able to populate the AKS cluster attributes, which
|
|
49
|
+
* requires the customer to have configured access to the `aks-cluster-metadata` ConfigMap.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
get aksResourceDetectorPopulated() {
|
|
53
|
+
return this._aksResourceDetectorPopulated;
|
|
54
|
+
}
|
|
44
55
|
browserSdkLoaderOptions;
|
|
45
56
|
/**
|
|
46
57
|
* Initializes a new instance of the AzureMonitorOpenTelemetryOptions class.
|
|
@@ -147,14 +158,24 @@ export class InternalConfig {
|
|
|
147
158
|
};
|
|
148
159
|
const envResource = detectResources(detectResourceConfig);
|
|
149
160
|
resource = resource.merge(envResource);
|
|
150
|
-
// Load resource attributes from Azure
|
|
161
|
+
// Load resource attributes from Azure. AKS is detected on its own so that we can tell
|
|
162
|
+
// whether the AKS detector itself populated the cluster attributes - other detectors and the
|
|
163
|
+
// customer can populate the same attributes without AKS being involved.
|
|
164
|
+
const aksResource = detectResources({
|
|
165
|
+
detectors: [azureAksDetector],
|
|
166
|
+
});
|
|
167
|
+
this._aksResourceDetectorPopulated = isAksResourceDetectorPopulated(aksResource.attributes);
|
|
151
168
|
const azureResource = detectResources({
|
|
152
|
-
detectors: [
|
|
169
|
+
detectors: [azureAppServiceDetector, azureContainerAppsDetector, azureFunctionsDetector],
|
|
153
170
|
});
|
|
154
|
-
this._resource = resource.merge(azureResource);
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
|
|
171
|
+
this._resource = resource.merge(aksResource).merge(azureResource);
|
|
172
|
+
// The IMDS probe fails on App Service, Functions, and Container Apps, and on AKS
|
|
173
|
+
// it describes the node VM rather than the cluster.
|
|
174
|
+
const platformDetected = aksResource.attributes[SEMRESATTRS_CLOUD_PLATFORM] ??
|
|
175
|
+
azureResource.attributes[SEMRESATTRS_CLOUD_PLATFORM];
|
|
176
|
+
if (!platformDetected) {
|
|
177
|
+
this._initializeVmResourceAsync();
|
|
178
|
+
}
|
|
158
179
|
}
|
|
159
180
|
/**
|
|
160
181
|
* Initialize VM resource detection asynchronously to avoid warnings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/shared/config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,i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D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAEM,6BAA6B,CAAC,OAAwC;QAC3E,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,aAAa;QAE5C,iDAAiD;QACjD,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACjF,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;gBAC3C,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAED,+BAA+B;QAC/B,IAAI,OAAO,EAAE,kBAAkB,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,kBAAkB,CAAC;QACpC,CAAC;QAED,mBAAmB;QACnB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ResourceDetectionConfig, Resource } from \"@opentelemetry/resources\";\nimport {\n defaultResource,\n detectResources,\n emptyResource,\n envDetector,\n} from \"@opentelemetry/resources\";\nimport type {\n BrowserSdkLoaderOptions,\n AzureMonitorOpenTelemetryOptions,\n InstrumentationOptions,\n} from \"../types.js\";\nimport type { Sampler } from \"@opentelemetry/sdk-trace-base\";\nimport type { AzureMonitorExporterOptions } from \"@azure/monitor-opentelemetry-exporter\";\nimport { EnvConfig } from \"./envConfig.js\";\nimport { JsonConfig } from \"./jsonConfig.js\";\nimport { Logger } from \"./logging/index.js\";\nimport {\n azureAksDetector,\n azureAppServiceDetector,\n azureFunctionsDetector,\n azureVmDetector,\n} from \"@opentelemetry/resource-detector-azure\";\n\n/**\n * Azure Monitor OpenTelemetry Client Configuration\n */\nexport class InternalConfig implements AzureMonitorOpenTelemetryOptions {\n /** The rate of telemetry items tracked that should be transmitted (Default 1.0) */\n public samplingRatio: number;\n /** The maximum number of spans to sample per second. */\n public tracesPerSecond?: number;\n /** Azure Monitor Exporter Configuration */\n public azureMonitorExporterOptions: AzureMonitorExporterOptions;\n /**\n * OpenTelemetry Instrumentations configuration included as part of Azure Monitor (azureSdk, http, mongoDb, mySql, postgreSql, redis, redis4)\n */\n public instrumentationOptions: InstrumentationOptions;\n /** Enable Live Metrics feature */\n enableLiveMetrics?: boolean;\n /** Enable Standard Metrics feature */\n enableStandardMetrics?: boolean;\n /** Enable log sampling based on trace (Default true) */\n enableTraceBasedSamplingForLogs?: boolean;\n /** Enable Performance Counter feature */\n enablePerformanceCounters?: boolean;\n /** Metric export interval in milliseconds */\n public metricExportIntervalMillis: number;\n /** Custom OpenTelemetry sampler (env-only) */\n public sampler?: Sampler;\n\n private _resource: Resource = emptyResource();\n\n public set resource(resource: Resource) {\n this._resource = this._resource.merge(resource);\n }\n\n /**\n *Get OpenTelemetry Resource\n */\n public get resource(): Resource {\n return this._resource;\n }\n\n public browserSdkLoaderOptions: BrowserSdkLoaderOptions;\n\n /**\n * Initializes a new instance of the AzureMonitorOpenTelemetryOptions class.\n */\n constructor(options?: AzureMonitorOpenTelemetryOptions) {\n // Default values\n this.azureMonitorExporterOptions = {};\n this.samplingRatio = 1;\n this.tracesPerSecond = 5;\n this.enableLiveMetrics = true;\n this.enableStandardMetrics = true;\n this.enableTraceBasedSamplingForLogs = false;\n this.enablePerformanceCounters = true;\n this.metricExportIntervalMillis = this.calculateMetricExportInterval();\n this.instrumentationOptions = {\n http: { enabled: true },\n azureSdk: { enabled: true },\n mongoDb: { enabled: true },\n mySql: { enabled: true },\n postgreSql: { enabled: true },\n redis: { enabled: true },\n redis4: { enabled: true },\n console: { enabled: false },\n };\n this._setDefaultResource();\n this.browserSdkLoaderOptions = {\n enabled: false,\n connectionString: \"\",\n };\n\n if (options) {\n // Merge default with provided options\n this.azureMonitorExporterOptions = Object.assign(\n this.azureMonitorExporterOptions,\n options.azureMonitorExporterOptions,\n );\n this.instrumentationOptions = Object.assign(\n this.instrumentationOptions,\n options.instrumentationOptions,\n );\n this.resource = Object.assign(this.resource, options.resource);\n this.samplingRatio =\n options.samplingRatio !== undefined ? options.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n options.tracesPerSecond !== undefined ? options.tracesPerSecond : this.tracesPerSecond;\n this.browserSdkLoaderOptions = Object.assign(\n this.browserSdkLoaderOptions,\n options.browserSdkLoaderOptions,\n );\n this.enableLiveMetrics =\n options.enableLiveMetrics !== undefined\n ? options.enableLiveMetrics\n : this.enableLiveMetrics;\n this.enableStandardMetrics =\n options.enableStandardMetrics !== undefined\n ? options.enableStandardMetrics\n : this.enableStandardMetrics;\n this.enableTraceBasedSamplingForLogs =\n options.enableTraceBasedSamplingForLogs !== undefined\n ? options.enableTraceBasedSamplingForLogs\n : this.enableTraceBasedSamplingForLogs;\n this.enablePerformanceCounters =\n options.enablePerformanceCounters !== undefined\n ? options.enablePerformanceCounters\n : this.enablePerformanceCounters;\n }\n // JSON configuration will take precedence over options provided\n this._mergeJsonConfig();\n // ENV configuration will take precedence over other configurations\n this._mergeEnvConfig();\n }\n\n private _mergeEnvConfig(): void {\n const envConfig = EnvConfig.getInstance();\n this.samplingRatio =\n envConfig.samplingRatio !== undefined ? envConfig.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n envConfig.tracesPerSecond !== undefined ? envConfig.tracesPerSecond : this.tracesPerSecond;\n this.sampler = envConfig.sampler ?? this.sampler;\n }\n\n private _mergeJsonConfig(): void {\n try {\n const jsonConfig = JsonConfig.getInstance();\n this.samplingRatio =\n jsonConfig.samplingRatio !== undefined ? jsonConfig.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n jsonConfig.tracesPerSecond !== undefined\n ? jsonConfig.tracesPerSecond\n : this.tracesPerSecond;\n this.browserSdkLoaderOptions = Object.assign(\n this.browserSdkLoaderOptions,\n jsonConfig.browserSdkLoaderOptions,\n );\n this.enableLiveMetrics =\n jsonConfig.enableLiveMetrics !== undefined\n ? jsonConfig.enableLiveMetrics\n : this.enableLiveMetrics;\n this.enableStandardMetrics =\n jsonConfig.enableStandardMetrics !== undefined\n ? jsonConfig.enableStandardMetrics\n : this.enableStandardMetrics;\n this.enableTraceBasedSamplingForLogs =\n jsonConfig.enableTraceBasedSamplingForLogs !== undefined\n ? jsonConfig.enableTraceBasedSamplingForLogs\n : this.enableTraceBasedSamplingForLogs;\n this.azureMonitorExporterOptions = Object.assign(\n this.azureMonitorExporterOptions,\n jsonConfig.azureMonitorExporterOptions,\n );\n this.instrumentationOptions = Object.assign(\n this.instrumentationOptions,\n jsonConfig.instrumentationOptions,\n );\n } catch (error) {\n Logger.getInstance().error(\"Failed to load JSON config file values.\", error);\n }\n }\n\n private _setDefaultResource(): void {\n let resource = defaultResource();\n // Load resource attributes from env\n const detectResourceConfig: ResourceDetectionConfig = {\n detectors: [envDetector],\n };\n const envResource = detectResources(detectResourceConfig);\n resource = resource.merge(envResource);\n\n // Load resource attributes from Azure\n const azureResource: Resource = detectResources({\n detectors: [azureAksDetector, azureAppServiceDetector, azureFunctionsDetector],\n });\n this._resource = resource.merge(azureResource);\n\n // Handle VM resource detection asynchronously to avoid warnings\n // about accessing resource attributes before async attributes are settled\n this._initializeVmResourceAsync();\n }\n\n /**\n * Initialize VM resource detection asynchronously to avoid warnings\n * about accessing resource attributes before async attributes settle\n */\n private _initializeVmResourceAsync(): void {\n const vmResource = detectResources({\n detectors: [azureVmDetector],\n });\n\n // Don't wait for VM resource detection to complete during initialization\n // This prevents warnings about accessing resource attributes before async attributes are settled\n if (vmResource.asyncAttributesPending) {\n void vmResource\n .waitForAsyncAttributes?.()\n .then(() => {\n this._resource = this._resource.merge(vmResource);\n return;\n })\n .catch(() => {\n // Silently ignore VM detection errors to avoid unnecessary warnings\n // VM detection is optional and failures shouldn't impact core functionality\n });\n } else {\n // If VM detection completed synchronously, merge immediately\n this._resource = this._resource.merge(vmResource);\n }\n }\n\n public calculateMetricExportInterval(options?: { collectionInterval: number }): number {\n const defaultInterval = 60000; // 60 seconds\n\n // Prioritize OTEL_METRIC_EXPORT_INTERVAL env var\n if (process.env.OTEL_METRIC_EXPORT_INTERVAL) {\n const envInterval = parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL.trim(), 10);\n if (!isNaN(envInterval) && envInterval > 0) {\n return envInterval;\n }\n }\n\n // Then use options if provided\n if (options?.collectionInterval) {\n return options.collectionInterval;\n }\n\n // Default fallback\n return defaultInterval;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/shared/config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,GAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,mFAAmF;IAC5E,aAAa,CAAS;IAC7B,wDAAwD;IACjD,eAAe,CAAU;IAChC,2CAA2C;IACpC,2BAA2B,CAA8B;IAChE;;OAEG;IACI,sBAAsB,CAAyB;IACtD,kCAAkC;IAClC,iBAAiB,CAAW;IAC5B,sCAAsC;IACtC,qBAAqB,CAAW;IAChC,wDAAwD;IACxD,+BAA+B,CAAW;IAC1C,yCAAyC;IACzC,yBAAyB,CAAW;IAC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AC;aAAM,CAAC;YACN,6DAA6D;YAC7D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAEM,6BAA6B,CAAC,OAAwC;QAC3E,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,aAAa;QAE5C,iDAAiD;QACjD,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,CAAC;YAC5C,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACjF,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;gBAC3C,OAAO,WAAW,CAAC;YACrB,CAAC;QACH,CAAC;QAED,+BAA+B;QAC/B,IAAI,OAAO,EAAE,kBAAkB,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,kBAAkB,CAAC;QACpC,CAAC;QAED,mBAAmB;QACnB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ResourceDetectionConfig, Resource } from \"@opentelemetry/resources\";\nimport {\n defaultResource,\n detectResources,\n emptyResource,\n envDetector,\n} from \"@opentelemetry/resources\";\nimport type {\n BrowserSdkLoaderOptions,\n AzureMonitorOpenTelemetryOptions,\n InstrumentationOptions,\n} from \"../types.js\";\nimport type { Sampler } from \"@opentelemetry/sdk-trace-base\";\nimport type { AzureMonitorExporterOptions } from \"@azure/monitor-opentelemetry-exporter\";\nimport { EnvConfig } from \"./envConfig.js\";\nimport { JsonConfig } from \"./jsonConfig.js\";\nimport { Logger } from \"./logging/index.js\";\nimport { isAksResourceDetectorPopulated } from \"../utils/common.js\";\nimport {\n azureAksDetector,\n azureAppServiceDetector,\n azureContainerAppsDetector,\n azureFunctionsDetector,\n azureVmDetector,\n} from \"@opentelemetry/resource-detector-azure\";\nimport { SEMRESATTRS_CLOUD_PLATFORM } from \"@opentelemetry/semantic-conventions\";\n\n/**\n * Azure Monitor OpenTelemetry Client Configuration\n */\nexport class InternalConfig implements AzureMonitorOpenTelemetryOptions {\n /** The rate of telemetry items tracked that should be transmitted (Default 1.0) */\n public samplingRatio: number;\n /** The maximum number of spans to sample per second. */\n public tracesPerSecond?: number;\n /** Azure Monitor Exporter Configuration */\n public azureMonitorExporterOptions: AzureMonitorExporterOptions;\n /**\n * OpenTelemetry Instrumentations configuration included as part of Azure Monitor (azureSdk, http, mongoDb, mySql, postgreSql, redis, redis4)\n */\n public instrumentationOptions: InstrumentationOptions;\n /** Enable Live Metrics feature */\n enableLiveMetrics?: boolean;\n /** Enable Standard Metrics feature */\n enableStandardMetrics?: boolean;\n /** Enable log sampling based on trace (Default true) */\n enableTraceBasedSamplingForLogs?: boolean;\n /** Enable Performance Counter feature */\n enablePerformanceCounters?: boolean;\n /** Metric export interval in milliseconds */\n public metricExportIntervalMillis: number;\n /** Custom OpenTelemetry sampler (env-only) */\n public sampler?: Sampler;\n\n private _resource: Resource = emptyResource();\n private _aksResourceDetectorPopulated: boolean = false;\n\n public set resource(resource: Resource) {\n this._resource = this._resource.merge(resource);\n }\n\n /**\n *Get OpenTelemetry Resource\n */\n public get resource(): Resource {\n return this._resource;\n }\n\n /**\n * Whether the AKS resource detector was able to populate the AKS cluster attributes, which\n * requires the customer to have configured access to the `aks-cluster-metadata` ConfigMap.\n * @internal\n */\n public get aksResourceDetectorPopulated(): boolean {\n return this._aksResourceDetectorPopulated;\n }\n\n public browserSdkLoaderOptions: BrowserSdkLoaderOptions;\n\n /**\n * Initializes a new instance of the AzureMonitorOpenTelemetryOptions class.\n */\n constructor(options?: AzureMonitorOpenTelemetryOptions) {\n // Default values\n this.azureMonitorExporterOptions = {};\n this.samplingRatio = 1;\n this.tracesPerSecond = 5;\n this.enableLiveMetrics = true;\n this.enableStandardMetrics = true;\n this.enableTraceBasedSamplingForLogs = false;\n this.enablePerformanceCounters = true;\n this.metricExportIntervalMillis = this.calculateMetricExportInterval();\n this.instrumentationOptions = {\n http: { enabled: true },\n azureSdk: { enabled: true },\n mongoDb: { enabled: true },\n mySql: { enabled: true },\n postgreSql: { enabled: true },\n redis: { enabled: true },\n redis4: { enabled: true },\n console: { enabled: false },\n };\n this._setDefaultResource();\n this.browserSdkLoaderOptions = {\n enabled: false,\n connectionString: \"\",\n };\n\n if (options) {\n // Merge default with provided options\n this.azureMonitorExporterOptions = Object.assign(\n this.azureMonitorExporterOptions,\n options.azureMonitorExporterOptions,\n );\n this.instrumentationOptions = Object.assign(\n this.instrumentationOptions,\n options.instrumentationOptions,\n );\n this.resource = Object.assign(this.resource, options.resource);\n this.samplingRatio =\n options.samplingRatio !== undefined ? options.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n options.tracesPerSecond !== undefined ? options.tracesPerSecond : this.tracesPerSecond;\n this.browserSdkLoaderOptions = Object.assign(\n this.browserSdkLoaderOptions,\n options.browserSdkLoaderOptions,\n );\n this.enableLiveMetrics =\n options.enableLiveMetrics !== undefined\n ? options.enableLiveMetrics\n : this.enableLiveMetrics;\n this.enableStandardMetrics =\n options.enableStandardMetrics !== undefined\n ? options.enableStandardMetrics\n : this.enableStandardMetrics;\n this.enableTraceBasedSamplingForLogs =\n options.enableTraceBasedSamplingForLogs !== undefined\n ? options.enableTraceBasedSamplingForLogs\n : this.enableTraceBasedSamplingForLogs;\n this.enablePerformanceCounters =\n options.enablePerformanceCounters !== undefined\n ? options.enablePerformanceCounters\n : this.enablePerformanceCounters;\n }\n // JSON configuration will take precedence over options provided\n this._mergeJsonConfig();\n // ENV configuration will take precedence over other configurations\n this._mergeEnvConfig();\n }\n\n private _mergeEnvConfig(): void {\n const envConfig = EnvConfig.getInstance();\n this.samplingRatio =\n envConfig.samplingRatio !== undefined ? envConfig.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n envConfig.tracesPerSecond !== undefined ? envConfig.tracesPerSecond : this.tracesPerSecond;\n this.sampler = envConfig.sampler ?? this.sampler;\n }\n\n private _mergeJsonConfig(): void {\n try {\n const jsonConfig = JsonConfig.getInstance();\n this.samplingRatio =\n jsonConfig.samplingRatio !== undefined ? jsonConfig.samplingRatio : this.samplingRatio;\n this.tracesPerSecond =\n jsonConfig.tracesPerSecond !== undefined\n ? jsonConfig.tracesPerSecond\n : this.tracesPerSecond;\n this.browserSdkLoaderOptions = Object.assign(\n this.browserSdkLoaderOptions,\n jsonConfig.browserSdkLoaderOptions,\n );\n this.enableLiveMetrics =\n jsonConfig.enableLiveMetrics !== undefined\n ? jsonConfig.enableLiveMetrics\n : this.enableLiveMetrics;\n this.enableStandardMetrics =\n jsonConfig.enableStandardMetrics !== undefined\n ? jsonConfig.enableStandardMetrics\n : this.enableStandardMetrics;\n this.enableTraceBasedSamplingForLogs =\n jsonConfig.enableTraceBasedSamplingForLogs !== undefined\n ? jsonConfig.enableTraceBasedSamplingForLogs\n : this.enableTraceBasedSamplingForLogs;\n this.azureMonitorExporterOptions = Object.assign(\n this.azureMonitorExporterOptions,\n jsonConfig.azureMonitorExporterOptions,\n );\n this.instrumentationOptions = Object.assign(\n this.instrumentationOptions,\n jsonConfig.instrumentationOptions,\n );\n } catch (error) {\n Logger.getInstance().error(\"Failed to load JSON config file values.\", error);\n }\n }\n\n private _setDefaultResource(): void {\n let resource = defaultResource();\n // Load resource attributes from env\n const detectResourceConfig: ResourceDetectionConfig = {\n detectors: [envDetector],\n };\n const envResource = detectResources(detectResourceConfig);\n resource = resource.merge(envResource);\n\n // Load resource attributes from Azure. AKS is detected on its own so that we can tell\n // whether the AKS detector itself populated the cluster attributes - other detectors and the\n // customer can populate the same attributes without AKS being involved.\n const aksResource: Resource = detectResources({\n detectors: [azureAksDetector],\n });\n this._aksResourceDetectorPopulated = isAksResourceDetectorPopulated(aksResource.attributes);\n\n const azureResource: Resource = detectResources({\n detectors: [azureAppServiceDetector, azureContainerAppsDetector, azureFunctionsDetector],\n });\n this._resource = resource.merge(aksResource).merge(azureResource);\n\n // The IMDS probe fails on App Service, Functions, and Container Apps, and on AKS\n // it describes the node VM rather than the cluster.\n const platformDetected =\n aksResource.attributes[SEMRESATTRS_CLOUD_PLATFORM] ??\n azureResource.attributes[SEMRESATTRS_CLOUD_PLATFORM];\n if (!platformDetected) {\n this._initializeVmResourceAsync();\n }\n }\n\n /**\n * Initialize VM resource detection asynchronously to avoid warnings\n * about accessing resource attributes before async attributes settle\n */\n private _initializeVmResourceAsync(): void {\n const vmResource = detectResources({\n detectors: [azureVmDetector],\n });\n\n // Don't wait for VM resource detection to complete during initialization\n // This prevents warnings about accessing resource attributes before async attributes are settled\n if (vmResource.asyncAttributesPending) {\n void vmResource\n .waitForAsyncAttributes?.()\n .then(() => {\n this._resource = this._resource.merge(vmResource);\n return;\n })\n .catch(() => {\n // Silently ignore VM detection errors to avoid unnecessary warnings\n // VM detection is optional and failures shouldn't impact core functionality\n });\n } else {\n // If VM detection completed synchronously, merge immediately\n this._resource = this._resource.merge(vmResource);\n }\n }\n\n public calculateMetricExportInterval(options?: { collectionInterval: number }): number {\n const defaultInterval = 60000; // 60 seconds\n\n // Prioritize OTEL_METRIC_EXPORT_INTERVAL env var\n if (process.env.OTEL_METRIC_EXPORT_INTERVAL) {\n const envInterval = parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL.trim(), 10);\n if (!isNaN(envInterval) && envInterval > 0) {\n return envInterval;\n }\n }\n\n // Then use options if provided\n if (options?.collectionInterval) {\n return options.collectionInterval;\n }\n\n // Default fallback\n return defaultInterval;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/traces/handler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/traces/handler.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAWnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EACV,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAIxC;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,mBAAmB,CAA4B;IACvD,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAU;IAE1B;;;;OAIG;gBACS,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa;IAqBzD,UAAU,IAAI,OAAO;IAIrB,qBAAqB,IAAI,kBAAkB;IAI3C,4BAA4B,IAAI,yBAAyB;IAIzD,mBAAmB,IAAI,eAAe,EAAE;IAI/C;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAOtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAwDnC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,yBAAyB;CAiBlC"}
|
|
@@ -48,13 +48,7 @@ export class TraceHandler {
|
|
|
48
48
|
this._sampler = new ApplicationInsightsSampler(this._config.samplingRatio);
|
|
49
49
|
}
|
|
50
50
|
this._azureExporter = new AzureMonitorTraceExporter(this._config.azureMonitorExporterOptions);
|
|
51
|
-
|
|
52
|
-
maxExportBatchSize: 512,
|
|
53
|
-
scheduledDelayMillis: 5000,
|
|
54
|
-
exportTimeoutMillis: 30000,
|
|
55
|
-
maxQueueSize: 2048,
|
|
56
|
-
};
|
|
57
|
-
this._batchSpanProcessor = new BatchSpanProcessor(this._azureExporter, bufferConfig);
|
|
51
|
+
this._batchSpanProcessor = new BatchSpanProcessor(this._azureExporter);
|
|
58
52
|
this._azureSpanProcessor = new AzureMonitorSpanProcessor(this._metricHandler);
|
|
59
53
|
this._azureFunctionsHook = new AzureFunctionsHook();
|
|
60
54
|
this._initializeInstrumentations();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/traces/handler.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAI5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD;;GAEG;AACH,MAAM,OAAO,YAAY;IACf,mBAAmB,CAAqB;IACxC,mBAAmB,CAA4B;IAC/C,cAAc,CAA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AAO,EACnD,CAAC;YACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CACzB,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CACpE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACK,yBAAyB,CAAC,eAAgC;QAChE,IAAI,CAAC;YACH,MAAM,iBAAiB,GAEnB,eAGD,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,CAAC;YACnC,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;gBACjD,IAAI,gBAAgB,CAAC,IAAI,KAAK,qBAAqB,IAAI,gBAAgB,CAAC,KAAK,EAAE,CAAC;oBAC9E,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,yDAAyD,EAAE,KAAK,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RequestOptions } from \"node:http\";\nimport { createAzureSdkInstrumentation } from \"@azure/opentelemetry-instrumentation-azure-sdk\";\nimport * as coreTracing from \"@azure/core-tracing\";\nimport {\n AzureMonitorTraceExporter,\n RateLimitedSampler,\n} from \"@azure/monitor-opentelemetry-exporter\";\nimport type { BufferConfig, Sampler } from \"@opentelemetry/sdk-trace-base\";\nimport { BatchSpanProcessor } from \"@opentelemetry/sdk-trace-base\";\nimport type {\n HttpInstrumentationConfig,\n IgnoreOutgoingRequestFunction,\n} from \"@opentelemetry/instrumentation-http\";\nimport { HttpInstrumentation } from \"@opentelemetry/instrumentation-http\";\nimport { MongoDBInstrumentation } from \"@opentelemetry/instrumentation-mongodb\";\nimport { MySQLInstrumentation } from \"@opentelemetry/instrumentation-mysql\";\nimport { PgInstrumentation } from \"@opentelemetry/instrumentation-pg\";\nimport { RedisInstrumentation } from \"@opentelemetry/instrumentation-redis\";\n\nimport type { InternalConfig } from \"../shared/config.js\";\nimport type { MetricHandler } from \"../metrics/handler.js\";\nimport { ignoreOutgoingRequestHook } from \"../utils/common.js\";\nimport { AzureMonitorSpanProcessor } from \"./spanProcessor.js\";\nimport { AzureFunctionsHook } from \"./azureFnHook.js\";\nimport type {\n Instrumentation,\n InstrumentationModuleDefinition,\n} from \"@opentelemetry/instrumentation\";\nimport { ApplicationInsightsSampler } from \"./sampler.js\";\nimport { Logger } from \"../shared/logging/index.js\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Handler\n */\nexport class TraceHandler {\n private _batchSpanProcessor: BatchSpanProcessor;\n private _azureSpanProcessor: AzureMonitorSpanProcessor;\n private _azureExporter: AzureMonitorTraceExporter;\n private _instrumentations: Instrumentation[];\n private _config: InternalConfig;\n private _metricHandler: MetricHandler;\n private _azureFunctionsHook: AzureFunctionsHook;\n private _sampler: Sampler;\n\n /**\n * Initializes a new instance of the TraceHandler class.\n * @param _config - Configuration.\n * @param _metricHandler - MetricHandler.\n */\n constructor(config: InternalConfig, metricHandler: MetricHandler) {\n this._config = config;\n this._metricHandler = metricHandler;\n this._instrumentations = [];\n // Check sampler precedence\n if (this._config.sampler) {\n this._sampler = this._config.sampler;\n } else if (this._config.tracesPerSecond && this._config.tracesPerSecond > 0) {\n // If tracesPerSecond is set to a positive number, use RateLimitedSampler\n this._sampler = new RateLimitedSampler(this._config.tracesPerSecond);\n } else {\n // Otherwise, use PercentageSampler with samplingRatio\n this._sampler = new ApplicationInsightsSampler(this._config.samplingRatio);\n }\n this._azureExporter = new AzureMonitorTraceExporter(this._config.azureMonitorExporterOptions);\n const bufferConfig: BufferConfig = {\n maxExportBatchSize: 512,\n scheduledDelayMillis: 5000,\n exportTimeoutMillis: 30000,\n maxQueueSize: 2048,\n };\n this._batchSpanProcessor = new BatchSpanProcessor(this._azureExporter, bufferConfig);\n this._azureSpanProcessor = new AzureMonitorSpanProcessor(this._metricHandler);\n this._azureFunctionsHook = new AzureFunctionsHook();\n this._initializeInstrumentations();\n }\n\n public getSampler(): Sampler {\n return this._sampler;\n }\n\n public getBatchSpanProcessor(): BatchSpanProcessor {\n return this._batchSpanProcessor;\n }\n\n public getAzureMonitorSpanProcessor(): AzureMonitorSpanProcessor {\n return this._azureSpanProcessor;\n }\n\n public getInstrumentations(): Instrumentation[] {\n return this._instrumentations;\n }\n\n /**\n * Shutdown handler\n */\n public async shutdown(): Promise<void> {\n this._azureFunctionsHook.shutdown();\n await this._batchSpanProcessor.shutdown();\n await this._azureSpanProcessor.shutdown();\n await this._azureExporter.shutdown();\n }\n\n /**\n * Start auto collection of telemetry\n */\n private _initializeInstrumentations(): void {\n if (this._config.instrumentationOptions.http?.enabled) {\n const httpinstrumentationOptions = this._config.instrumentationOptions\n .http as HttpInstrumentationConfig;\n const providedIgnoreOutgoingRequestHook =\n httpinstrumentationOptions.ignoreOutgoingRequestHook;\n const mergedIgnoreOutgoingRequestHook: IgnoreOutgoingRequestFunction = (\n request: RequestOptions,\n ) => {\n const result = ignoreOutgoingRequestHook(request);\n if (!result) {\n // Not internal call\n if (providedIgnoreOutgoingRequestHook) {\n // Provided hook in config\n return providedIgnoreOutgoingRequestHook(request);\n }\n }\n return result;\n };\n httpinstrumentationOptions.ignoreOutgoingRequestHook = mergedIgnoreOutgoingRequestHook;\n this._instrumentations.push(\n new HttpInstrumentation(this._config.instrumentationOptions.http),\n );\n }\n if (this._config.instrumentationOptions.azureSdk?.enabled) {\n const azureSdkInstrumentation = createAzureSdkInstrumentation(\n this._config.instrumentationOptions.azureSdk,\n );\n this._instrumentations.push(azureSdkInstrumentation);\n this._wireAzureSdkInstrumenter(azureSdkInstrumentation);\n }\n if (this._config.instrumentationOptions.mongoDb?.enabled) {\n this._instrumentations.push(\n new MongoDBInstrumentation(this._config.instrumentationOptions.mongoDb),\n );\n }\n if (this._config.instrumentationOptions.mySql?.enabled) {\n this._instrumentations.push(\n new MySQLInstrumentation(this._config.instrumentationOptions.mySql),\n );\n }\n if (this._config.instrumentationOptions.postgreSql?.enabled) {\n this._instrumentations.push(\n new PgInstrumentation(this._config.instrumentationOptions.postgreSql),\n );\n }\n if (\n this._config.instrumentationOptions.redis?.enabled ||\n this._config.instrumentationOptions.redis4?.enabled\n ) {\n this._instrumentations.push(\n new RedisInstrumentation(this._config.instrumentationOptions.redis),\n );\n }\n }\n\n /**\n * Wire the Azure SDK instrumenter into `@azure/core-tracing` directly.\n *\n * The Azure SDK instrumentation registers its instrumenter through an OpenTelemetry\n * module-patch hook that only fires via `require`/`import`-in-the-middle. In ESM hosts\n * where the OpenTelemetry loader cannot be registered up front (for example, Azure\n * Functions, which controls the Node.js start command), that hook never runs, so Azure\n * SDK dependency spans are missing. Because `@azure/core-tracing` resolves its\n * instrumenter lazily at span-creation time from shared module-local state, applying\n * the same patch directly here enables Azure SDK tracing regardless of module system.\n */\n private _wireAzureSdkInstrumenter(instrumentation: Instrumentation): void {\n try {\n const moduleDefinitions =\n (\n instrumentation as Instrumentation & {\n getModuleDefinitions?: () => InstrumentationModuleDefinition[];\n }\n ).getModuleDefinitions?.() ?? [];\n for (const moduleDefinition of moduleDefinitions) {\n if (moduleDefinition.name === \"@azure/core-tracing\" && moduleDefinition.patch) {\n moduleDefinition.patch(coreTracing);\n }\n }\n } catch (error) {\n Logger.getInstance().warn(\"Failed to enable Azure SDK tracing for ESM applications\", error);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/traces/handler.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,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from \"node:http\";\nimport { createAzureSdkInstrumentation } from \"@azure/opentelemetry-instrumentation-azure-sdk\";\nimport * as coreTracing from \"@azure/core-tracing\";\nimport {\n AzureMonitorTraceExporter,\n RateLimitedSampler,\n} from \"@azure/monitor-opentelemetry-exporter\";\nimport type { Sampler } from \"@opentelemetry/sdk-trace-base\";\nimport { BatchSpanProcessor } from \"@opentelemetry/sdk-trace-base\";\nimport type {\n HttpInstrumentationConfig,\n IgnoreOutgoingRequestFunction,\n} from \"@opentelemetry/instrumentation-http\";\nimport { HttpInstrumentation } from \"@opentelemetry/instrumentation-http\";\nimport { MongoDBInstrumentation } from \"@opentelemetry/instrumentation-mongodb\";\nimport { MySQLInstrumentation } from \"@opentelemetry/instrumentation-mysql\";\nimport { PgInstrumentation } from \"@opentelemetry/instrumentation-pg\";\nimport { RedisInstrumentation } from \"@opentelemetry/instrumentation-redis\";\n\nimport type { InternalConfig } from \"../shared/config.js\";\nimport type { MetricHandler } from \"../metrics/handler.js\";\nimport { ignoreOutgoingRequestHook } from \"../utils/common.js\";\nimport { AzureMonitorSpanProcessor } from \"./spanProcessor.js\";\nimport { AzureFunctionsHook } from \"./azureFnHook.js\";\nimport type {\n Instrumentation,\n InstrumentationModuleDefinition,\n} from \"@opentelemetry/instrumentation\";\nimport { ApplicationInsightsSampler } from \"./sampler.js\";\nimport { Logger } from \"../shared/logging/index.js\";\n\n/**\n * Azure Monitor OpenTelemetry Trace Handler\n */\nexport class TraceHandler {\n private _batchSpanProcessor: BatchSpanProcessor;\n private _azureSpanProcessor: AzureMonitorSpanProcessor;\n private _azureExporter: AzureMonitorTraceExporter;\n private _instrumentations: Instrumentation[];\n private _config: InternalConfig;\n private _metricHandler: MetricHandler;\n private _azureFunctionsHook: AzureFunctionsHook;\n private _sampler: Sampler;\n\n /**\n * Initializes a new instance of the TraceHandler class.\n * @param _config - Configuration.\n * @param _metricHandler - MetricHandler.\n */\n constructor(config: InternalConfig, metricHandler: MetricHandler) {\n this._config = config;\n this._metricHandler = metricHandler;\n this._instrumentations = [];\n // Check sampler precedence\n if (this._config.sampler) {\n this._sampler = this._config.sampler;\n } else if (this._config.tracesPerSecond && this._config.tracesPerSecond > 0) {\n // If tracesPerSecond is set to a positive number, use RateLimitedSampler\n this._sampler = new RateLimitedSampler(this._config.tracesPerSecond);\n } else {\n // Otherwise, use PercentageSampler with samplingRatio\n this._sampler = new ApplicationInsightsSampler(this._config.samplingRatio);\n }\n this._azureExporter = new AzureMonitorTraceExporter(this._config.azureMonitorExporterOptions);\n this._batchSpanProcessor = new BatchSpanProcessor(this._azureExporter);\n this._azureSpanProcessor = new AzureMonitorSpanProcessor(this._metricHandler);\n this._azureFunctionsHook = new AzureFunctionsHook();\n this._initializeInstrumentations();\n }\n\n public getSampler(): Sampler {\n return this._sampler;\n }\n\n public getBatchSpanProcessor(): BatchSpanProcessor {\n return this._batchSpanProcessor;\n }\n\n public getAzureMonitorSpanProcessor(): AzureMonitorSpanProcessor {\n return this._azureSpanProcessor;\n }\n\n public getInstrumentations(): Instrumentation[] {\n return this._instrumentations;\n }\n\n /**\n * Shutdown handler\n */\n public async shutdown(): Promise<void> {\n this._azureFunctionsHook.shutdown();\n await this._batchSpanProcessor.shutdown();\n await this._azureSpanProcessor.shutdown();\n await this._azureExporter.shutdown();\n }\n\n /**\n * Start auto collection of telemetry\n */\n private _initializeInstrumentations(): void {\n if (this._config.instrumentationOptions.http?.enabled) {\n const httpinstrumentationOptions = this._config.instrumentationOptions\n .http as HttpInstrumentationConfig;\n const providedIgnoreOutgoingRequestHook =\n httpinstrumentationOptions.ignoreOutgoingRequestHook;\n const mergedIgnoreOutgoingRequestHook: IgnoreOutgoingRequestFunction = (\n request: RequestOptions,\n ) => {\n const result = ignoreOutgoingRequestHook(request);\n if (!result) {\n // Not internal call\n if (providedIgnoreOutgoingRequestHook) {\n // Provided hook in config\n return providedIgnoreOutgoingRequestHook(request);\n }\n }\n return result;\n };\n httpinstrumentationOptions.ignoreOutgoingRequestHook = mergedIgnoreOutgoingRequestHook;\n this._instrumentations.push(\n new HttpInstrumentation(this._config.instrumentationOptions.http),\n );\n }\n if (this._config.instrumentationOptions.azureSdk?.enabled) {\n const azureSdkInstrumentation = createAzureSdkInstrumentation(\n this._config.instrumentationOptions.azureSdk,\n );\n this._instrumentations.push(azureSdkInstrumentation);\n this._wireAzureSdkInstrumenter(azureSdkInstrumentation);\n }\n if (this._config.instrumentationOptions.mongoDb?.enabled) {\n this._instrumentations.push(\n new MongoDBInstrumentation(this._config.instrumentationOptions.mongoDb),\n );\n }\n if (this._config.instrumentationOptions.mySql?.enabled) {\n this._instrumentations.push(\n new MySQLInstrumentation(this._config.instrumentationOptions.mySql),\n );\n }\n if (this._config.instrumentationOptions.postgreSql?.enabled) {\n this._instrumentations.push(\n new PgInstrumentation(this._config.instrumentationOptions.postgreSql),\n );\n }\n if (\n this._config.instrumentationOptions.redis?.enabled ||\n this._config.instrumentationOptions.redis4?.enabled\n ) {\n this._instrumentations.push(\n new RedisInstrumentation(this._config.instrumentationOptions.redis),\n );\n }\n }\n\n /**\n * Wire the Azure SDK instrumenter into `@azure/core-tracing` directly.\n *\n * The Azure SDK instrumentation registers its instrumenter through an OpenTelemetry\n * module-patch hook that only fires via `require`/`import`-in-the-middle. In ESM hosts\n * where the OpenTelemetry loader cannot be registered up front (for example, Azure\n * Functions, which controls the Node.js start command), that hook never runs, so Azure\n * SDK dependency spans are missing. Because `@azure/core-tracing` resolves its\n * instrumenter lazily at span-creation time from shared module-local state, applying\n * the same patch directly here enables Azure SDK tracing regardless of module system.\n */\n private _wireAzureSdkInstrumenter(instrumentation: Instrumentation): void {\n try {\n const moduleDefinitions =\n (\n instrumentation as Instrumentation & {\n getModuleDefinitions?: () => InstrumentationModuleDefinition[];\n }\n ).getModuleDefinitions?.() ?? [];\n for (const moduleDefinition of moduleDefinitions) {\n if (moduleDefinition.name === \"@azure/core-tracing\" && moduleDefinition.patch) {\n moduleDefinition.patch(coreTracing);\n }\n }\n } catch (error) {\n Logger.getInstance().warn(\"Failed to enable Azure SDK tracing for ESM applications\", error);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampler.js","sourceRoot":"","sources":["../../../src/traces/sampler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,0BAA0B;IACpB,WAAW,CAAS;IACpB,cAAc,CAAS;IAExC;;;OAGG;IACH,YAAY,gBAAwB,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IACE,IAAI,CAAC,cAAc,GAAG,CAAC;YACvB,IAAI,CAAC,cAAc,GAAG,CAAC;YACvB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,EACrC,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACxF,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,GAAG,GAAG,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,YAAY;IACjB,8BAA8B;IAC9B,OAAgB,EAChB,OAAe;IACf,8BAA8B;IAC9B,QAAgB;IAChB,8BAA8B;IAC9B,QAAkB,EAClB,UAAsB;IACtB,8BAA8B;IAC9B,KAAa;QAEb,IAAI,
|
|
1
|
+
{"version":3,"file":"sampler.js","sourceRoot":"","sources":["../../../src/traces/sampler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;G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B,EAAE,UAAU,EAAE,UAAU,EAAE;YAC3E,CAAC,CAAC,EAAE,QAAQ,EAAE,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,8BAA8B,IAAI,CAAC,cAAc,GAAG,CAAC;IAC9D,CAAC;IAEO,oBAAoB,CAAC,KAAa;QACxC,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC;QAC9B,MAAM,SAAS,GAAG,UAAU,CAAC;QAC7B,IAAI,IAAI,GAAG,IAAI,CAAC;QAEhB,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;QACxB,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,uGAAuG;YACvG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC;IAClC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * TODO: Remove this sampler in favor of the implementation in the AzMon Exporter once we support M2M approach for standard metrics.\n * This sampler specifically marks spans as sampled out and records them instead of dropping the span altogether.\n */\nimport type { Link, Attributes, SpanKind, Context } from \"@opentelemetry/api\";\nimport { diag } from \"@opentelemetry/api\";\nimport type { Sampler, SamplingResult } from \"@opentelemetry/sdk-trace-base\";\nimport { SamplingDecision } from \"@opentelemetry/sdk-trace-base\";\nimport { AzureMonitorSampleRate } from \"../types.js\";\n\n/**\n * ApplicationInsightsSampler is responsible for the following:\n * Implements same trace id hashing algorithm so that traces are sampled the same across multiple nodes\n * Adds item count to span attribute if span is sampled (needed for ingestion service)\n * @param samplingRatio - 0 to 1 value.\n */\nexport class ApplicationInsightsSampler implements Sampler {\n private readonly _sampleRate: number;\n private readonly _samplingRatio: number;\n\n /**\n * Initializes a new instance of the ApplicationInsightsSampler class.\n * @param samplingRatio - Value in the range [0,1], 1 meaning all data will sampled and 0 all Tracing data will be sampled out.\n */\n constructor(samplingRatio: number = 1) {\n this._samplingRatio = samplingRatio;\n if (\n this._samplingRatio > 1 ||\n this._samplingRatio < 0 ||\n !Number.isFinite(this._samplingRatio)\n ) {\n diag.warn(\"Invalid sampling rate, sampling rate must be a value in the range [0,1].\");\n }\n this._sampleRate = Math.round(this._samplingRatio * 100);\n }\n\n /**\n * Checks whether span needs to be created and tracked.\n *\n * @param context - Parent Context which may contain a span.\n * @param traceId - of the span to be created. It can be different from the\n * traceId in the {@link SpanContext}. Typically in situations when the\n * span to be created starts a new trace.\n * @param spanName - of the span to be created.\n * @param spanKind - of the span to be created.\n * @param attributes - Initial set of SpanAttributes for the Span being constructed.\n * @param links - Collection of links that will be associated with the Span to\n * be created. Typically useful for batch operations.\n * @returns a {@link SamplingResult}.\n */\n public shouldSample(\n // @ts-expect-error unused var\n context: Context,\n traceId: string,\n // @ts-expect-error unused var\n spanName: string,\n // @ts-expect-error unused var\n spanKind: SpanKind,\n attributes: Attributes,\n // @ts-expect-error unused var\n links: Link[],\n ): SamplingResult {\n let isSampledIn: boolean;\n if (this._sampleRate === 100) {\n isSampledIn = true;\n } else if (this._sampleRate === 0) {\n isSampledIn = false;\n } else {\n isSampledIn = this._getSamplingHashCode(traceId) < this._sampleRate;\n }\n // Add sample rate as span attribute if it is not 100\n attributes = attributes || {};\n if (this._sampleRate !== 100) {\n attributes[AzureMonitorSampleRate] = this._sampleRate;\n }\n return isSampledIn\n ? { decision: SamplingDecision.RECORD_AND_SAMPLED, attributes: attributes }\n : { decision: SamplingDecision.RECORD, attributes: attributes };\n }\n\n /**\n * Return Sampler description\n */\n public toString(): string {\n return `ApplicationInsightsSampler{${this._samplingRatio}}`;\n }\n\n private _getSamplingHashCode(input: string): number {\n const csharpMin = -2147483648;\n const csharpMax = 2147483647;\n let hash = 5381;\n\n if (!input) {\n return 0;\n }\n\n while (input.length < 8) {\n input = input + input;\n }\n\n for (let i = 0; i < input.length; i++) {\n // JS doesn't respond to integer overflow by wrapping around. Simulate it with bitwise operators ( | 0)\n hash = ((((hash << 5) + hash) | 0) + input.charCodeAt(i)) | 0;\n }\n\n hash = hash <= csharpMin ? csharpMax : Math.abs(hash);\n return (hash / csharpMax) * 100;\n }\n}\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AzureMonitorExporterOptions } from "@azure/monitor-opentelemetry-exporter";
|
|
2
2
|
import type { InstrumentationConfig } from "@opentelemetry/instrumentation";
|
|
3
|
+
import type { SeverityNumber } from "@opentelemetry/api-logs";
|
|
3
4
|
import type { Resource } from "@opentelemetry/resources";
|
|
4
5
|
import type { LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
5
6
|
import type { MetricReader, ViewOptions } from "@opentelemetry/sdk-metrics";
|
|
@@ -60,7 +61,15 @@ export interface InstrumentationOptions {
|
|
|
60
61
|
/** Winston Instrumentation Config */
|
|
61
62
|
winston?: InstrumentationConfig;
|
|
62
63
|
/** Console Instrumentation Config */
|
|
63
|
-
console?:
|
|
64
|
+
console?: ConsoleInstrumentationOptions;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Console Instrumentation Configuration interface
|
|
68
|
+
*/
|
|
69
|
+
export interface ConsoleInstrumentationOptions extends InstrumentationConfig {
|
|
70
|
+
/** The minimum severity of `console` calls to collect. Defaults to the value derived from the
|
|
71
|
+
* `APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL` environment variable. */
|
|
72
|
+
logSeverity?: SeverityNumber;
|
|
64
73
|
}
|
|
65
74
|
/**
|
|
66
75
|
* Statsbeat Features Configuration interface
|
|
@@ -143,7 +152,7 @@ export interface BrowserSdkLoaderOptions {
|
|
|
143
152
|
/** Browser SDK Loader Connection String */
|
|
144
153
|
connectionString?: string;
|
|
145
154
|
}
|
|
146
|
-
export declare const AZURE_MONITOR_OPENTELEMETRY_VERSION = "1.
|
|
155
|
+
export declare const AZURE_MONITOR_OPENTELEMETRY_VERSION = "1.20.0";
|
|
147
156
|
export declare const AZURE_MONITOR_STATSBEAT_FEATURES = "AZURE_MONITOR_STATSBEAT_FEATURES";
|
|
148
157
|
export declare const AZURE_MONITOR_PREFIX = "AZURE_MONITOR_PREFIX";
|
|
149
158
|
export declare const AZURE_MONITOR_AUTO_ATTACH = "AZURE_MONITOR_AUTO_ATTACH";
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,2CAA2C;IAC3C,2BAA2B,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