Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
db5c8f1
Update to 2.x dependencies.
JacksonWeber Jul 3, 2025
26a74c6
Initial update commit.
JacksonWeber Jul 7, 2025
4c9b3d2
Add todos.
JacksonWeber Jul 7, 2025
263b193
Use extensible processor workaround.
JacksonWeber Jul 9, 2025
508fae0
We no longer allow attempts to add metric exporters on the fly.
JacksonWeber Jul 9, 2025
bea1f93
Use default exports over wildcard exports.
JacksonWeber Jul 9, 2025
1b06d59
Use further default exports.
JacksonWeber Jul 9, 2025
32a1588
Fix interface issues with config tests.
JacksonWeber Jul 9, 2025
fe04201
Update the histogram creation test.
JacksonWeber Jul 9, 2025
9f100df
Merge branch 'main' into jacksonweber/upgrade-2.x-otel
JacksonWeber Jul 9, 2025
5dfcf20
Clean unused code.
JacksonWeber Jul 9, 2025
e23ce0d
Remove unused imports.
JacksonWeber Jul 10, 2025
10968f6
Revert back compat tests.
JacksonWeber Jul 10, 2025
76aa81f
Update integration.yml
JacksonWeber Jul 10, 2025
5fe68e2
Remove the extensible processors.
JacksonWeber Jul 10, 2025
baf671b
Fix telemetry client tests.
JacksonWeber Jul 10, 2025
9289a40
Testing updates to integration tests & add new tests for OTLP exporters.
JacksonWeber Jul 21, 2025
e92e4a5
Fix integration tests failing from otel telemetry.
JacksonWeber Jul 21, 2025
5404e3c
Update testValidation.js
JacksonWeber Jul 21, 2025
2eebbd1
Update testValidation.js
JacksonWeber Jul 21, 2025
c3e9a39
Fix test check.
JacksonWeber Jul 21, 2025
56b0a8b
Update testValidation.js
JacksonWeber Jul 21, 2025
4793be2
Clean up changes.
JacksonWeber Jul 22, 2025
5f16de4
Pin sdk-logs version and fix typing.
JacksonWeber Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
# TODO: Enable Node 14.x when we update the pipeline to support AbortController
node-version: [16.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
2,889 changes: 2,136 additions & 753 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@
"@azure/functions": "^4.6.0",
"@azure/functions-old": "npm:@azure/functions@3.5.1",
"@azure/identity": "^4.6.0",
"@azure/monitor-opentelemetry": "^1.11.0",
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.31",
"@azure/monitor-opentelemetry": "^1.11.1",
"@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.32",
"@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/api-logs": "^0.57.2",
"@opentelemetry/core": "^1.30.1",
"@opentelemetry/exporter-logs-otlp-http": "^0.57.2",
"@opentelemetry/exporter-metrics-otlp-http": "^0.57.2",
"@opentelemetry/exporter-trace-otlp-http": "^0.57.2",
"@opentelemetry/otlp-exporter-base": "^0.57.2",
"@opentelemetry/resources": "^1.30.1",
"@opentelemetry/sdk-logs": "^0.57.2",
"@opentelemetry/sdk-metrics": "^1.30.1",
"@opentelemetry/sdk-trace-base": "^1.30.1",
"@opentelemetry/sdk-trace-node": "^1.30.1",
"@opentelemetry/semantic-conventions": "^1.30.0",
"@opentelemetry/api-logs": "^0.202.0",
"@opentelemetry/core": "^2.0.1",
"@opentelemetry/exporter-logs-otlp-http": "^0.202.0",
"@opentelemetry/exporter-metrics-otlp-http": "^0.202.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.202.0",
"@opentelemetry/otlp-exporter-base": "^0.202.0",
"@opentelemetry/resources": "^2.0.1",
"@opentelemetry/sdk-logs": "0.200.0",
"@opentelemetry/sdk-metrics": "^2.0.1",
"@opentelemetry/sdk-trace-base": "^2.0.1",
"@opentelemetry/sdk-trace-node": "^2.0.1",
"@opentelemetry/semantic-conventions": "^1.34.0",
"diagnostic-channel": "1.1.1",
"diagnostic-channel-publishers": "1.0.8"
}
Expand Down
4 changes: 2 additions & 2 deletions src/agent/appServicesLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SEMRESATTRS_SERVICE_NAME,
SEMRESATTRS_SERVICE_INSTANCE_ID,
} from '@opentelemetry/semantic-conventions';
import { Resource } from '@opentelemetry/resources';
import { resourceFromAttributes } from '@opentelemetry/resources';
import { DiagnosticLogger } from './diagnostics/diagnosticLogger';
import { EtwDiagnosticLogger } from './diagnostics/etwDiagnosticLogger';
import { FileWriter } from "./diagnostics/writers/fileWriter";
Expand All @@ -30,7 +30,7 @@ export class AppServicesLoader extends AgentLoader {
resourceAttributes[SEMRESATTRS_SERVICE_INSTANCE_ID] =
process.env.WEBSITE_INSTANCE_ID;
}
const resource = new Resource(resourceAttributes);
const resource = resourceFromAttributes(resourceAttributes);
this._options.resource = resource;

let statusLogDir = '/var/log/applicationinsights/';
Expand Down
6 changes: 3 additions & 3 deletions src/agent/azureFunctionsLoader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { Resource } from "@opentelemetry/resources";
import { resourceFromAttributes } from "@opentelemetry/resources";
import { AgentLoader } from "./agentLoader";
import { DiagnosticLogger } from "./diagnostics/diagnosticLogger";
import { StatusLogger } from "./diagnostics/statusLogger";
Expand All @@ -10,7 +10,7 @@ import { Attributes } from "@opentelemetry/api";
import {
SEMRESATTRS_SERVICE_NAME,
SEMRESATTRS_SERVICE_INSTANCE_ID,
} from "@opentelemetry/semantic-conventions"
} from "@opentelemetry/semantic-conventions";

export class AzureFunctionsLoader extends AgentLoader {

Expand All @@ -29,7 +29,7 @@ export class AzureFunctionsLoader extends AgentLoader {
resourceAttributes[SEMRESATTRS_SERVICE_INSTANCE_ID] =
process.env.WEBSITE_INSTANCE_ID;
}
const resource = new Resource(resourceAttributes);
const resource = resourceFromAttributes(resourceAttributes);
this._options.resource = resource;

const writer = new AzureFunctionsWriter(this._instrumentationKey);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export {
PageViewTelemetry,
Telemetry,
} from "./declarations/contracts";
export { useAzureMonitor, shutdownAzureMonitor } from "./main";
export { useAzureMonitor, shutdownAzureMonitor, flushAzureMonitor } from "./main";

// To support the shim
export * from "./shim/applicationinsights";
74 changes: 37 additions & 37 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,17 @@
import { shutdownAzureMonitor as distroShutdownAzureMonitor, useAzureMonitor as distroUseAzureMonitor } from "@azure/monitor-opentelemetry";
import { ProxyTracerProvider, diag, metrics, trace } from "@opentelemetry/api";
import { logs } from "@opentelemetry/api-logs";
import { MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
import { MeterProvider } from "@opentelemetry/sdk-metrics";
import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
import { BasicTracerProvider, BatchSpanProcessor, NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
import { BasicTracerProvider, BatchSpanProcessor, SpanProcessor } from "@opentelemetry/sdk-trace-node";
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

import { AutoCollectLogs } from "./logs/autoCollectLogs";
import { AutoCollectExceptions } from "./logs/exceptions";
import { AzureMonitorOpenTelemetryOptions } from "./types";
import { ApplicationInsightsConfig } from "./shared/configuration/config";
import { LogApi } from "./shim/logsApi";
import { StatsbeatFeature } from "./shim/types";
import { RequestSpanProcessor } from "./traces/requestProcessor";
import { StatsbeatFeaturesManager } from "./shared/util/statsbeatFeaturesManager";

let autoCollectLogs: AutoCollectLogs;
Expand All @@ -33,16 +30,38 @@ export function useAzureMonitor(options?: AzureMonitorOpenTelemetryOptions) {
StatsbeatFeaturesManager.getInstance().enableFeature(StatsbeatFeature.SHIM);

// Allows for full filtering of dependency/request spans
options.spanProcessors = [new RequestSpanProcessor(options.enableAutoCollectDependencies, options.enableAutoCollectRequests)];
distroUseAzureMonitor(options);
const internalConfig = new ApplicationInsightsConfig(options);

// Add OTLP exporters if configured
const otlpSpanProcessor = _getOtlpSpanExporter(internalConfig);
const otlpLogProcessor = _getOtlpLogExporter(internalConfig);

// Ensure options object exists and add processors
if (!options) {
options = {};
}

if (otlpSpanProcessor) {
if (!options.spanProcessors) {
options.spanProcessors = [];
}
options.spanProcessors.push(otlpSpanProcessor);
}

if (otlpLogProcessor) {
if (!options.logRecordProcessors) {
options.logRecordProcessors = [];
}
options.logRecordProcessors.push(otlpLogProcessor);
}

distroUseAzureMonitor(options);
const logApi = new LogApi(logs.getLogger("ApplicationInsightsLogger"));
autoCollectLogs = new AutoCollectLogs();
if (internalConfig.enableAutoCollectExceptions) {
exceptions = new AutoCollectExceptions(logApi);
}
autoCollectLogs.enable(internalConfig.instrumentationOptions);
_addOtlpExporters(internalConfig);
}

/**
Expand All @@ -55,7 +74,7 @@ export async function shutdownAzureMonitor() {
}

/**
*Try to send all queued telemetry if present.
* Try to send all queued telemetry if present.
*/
export async function flushAzureMonitor() {
try {
Expand All @@ -67,37 +86,18 @@ export async function flushAzureMonitor() {
}
}

function _addOtlpExporters(internalConfig: ApplicationInsightsConfig) {
if (internalConfig.otlpMetricExporterConfig?.enabled) {
const otlpMetricsExporter = new OTLPMetricExporter(internalConfig.otlpMetricExporterConfig);
const otlpMetricReader = new PeriodicExportingMetricReader({
exporter: otlpMetricsExporter,
});
try {
(metrics.getMeterProvider() as MeterProvider).addMetricReader(otlpMetricReader);
}
catch (err) {
diag.error("Failed to set OTLP Metric Exporter", err);
}
function _getOtlpSpanExporter(internalConfig: ApplicationInsightsConfig): SpanProcessor {
if (internalConfig.otlpTraceExporterConfig?.enabled) {
const otlpTraceExporter = new OTLPTraceExporter(internalConfig.otlpTraceExporterConfig);
const otlpSpanProcessor = new BatchSpanProcessor(otlpTraceExporter);
return otlpSpanProcessor;
}
}

function _getOtlpLogExporter(internalConfig: ApplicationInsightsConfig): BatchLogRecordProcessor {
if (internalConfig.otlpLogExporterConfig?.enabled) {
const otlpLogExporter = new OTLPLogExporter(internalConfig.otlpLogExporterConfig);
const otlpLogProcessor = new BatchLogRecordProcessor(otlpLogExporter);
try {
(logs.getLoggerProvider() as LoggerProvider).addLogRecordProcessor(otlpLogProcessor);
}
catch (err) {
diag.error("Failed to set OTLP Log Exporter", err);
}
}
if (internalConfig.otlpTraceExporterConfig?.enabled) {
const otlpTraceExporter = new OTLPTraceExporter(internalConfig.otlpTraceExporterConfig);
const otlpSpanProcessor = new BatchSpanProcessor(otlpTraceExporter);
try {
((trace.getTracerProvider() as ProxyTracerProvider).getDelegate() as NodeTracerProvider).addSpanProcessor(otlpSpanProcessor);
}
catch (err) {
diag.error("Failed to set OTLP Trace Exporter", err);
}
return otlpLogProcessor;
}
}
13 changes: 3 additions & 10 deletions src/shared/configuration/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { AzureMonitorExporterOptions } from "@azure/monitor-opentelemetry-export
import { diag } from "@opentelemetry/api";
import {
Resource,
ResourceDetectionConfig,
detectResourcesSync,
envDetectorSync,
defaultResource,
} from "@opentelemetry/resources";
import { JsonConfig } from "./jsonConfig";
import { AzureMonitorOpenTelemetryOptions, OTLPExporterConfig, InstrumentationOptions } from "../../types";
Expand Down Expand Up @@ -170,13 +168,8 @@ export class ApplicationInsightsConfig {
}

private _getDefaultResource(): Resource {
let resource = Resource.default();
// Load resource attributes from env
const detectResourceConfig: ResourceDetectionConfig = {
detectors: [envDetectorSync],
};
const envResource = detectResourcesSync(detectResourceConfig);
resource = resource.merge(envResource);
// Create a basic resource with default attributes
const resource = defaultResource();
return resource;
}
}
9 changes: 5 additions & 4 deletions src/shared/util/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import * as http from "http";

export function ignoreOutgoingRequestHook(request: http.RequestOptions): boolean {
if (request && request.headers) {
const headers = request.headers as { [key: string]: string | string[] | undefined };
if (
(request.headers["User-Agent"] &&
request.headers["User-Agent"]
(headers["User-Agent"] &&
headers["User-Agent"]
.toString()
.indexOf("azsdk-js-monitor-opentelemetry-exporter") > -1) ||
(request.headers["user-agent"] &&
request.headers["user-agent"]
(headers["user-agent"] &&
headers["user-agent"]
.toString()
.indexOf("azsdk-js-monitor-opentelemetry-exporter") > -1)
) {
Expand Down
4 changes: 2 additions & 2 deletions src/shim/correlationContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
}
const traceStateObj: TraceState = new TraceState(activeSpan?.spanContext()?.traceState?.serialize());

return this.spanToContextObject(activeSpan?.spanContext(), activeSpan?.parentSpanId, activeSpan?.name, traceStateObj);
return this.spanToContextObject(activeSpan?.spanContext(), activeSpan?.parentSpanContext?.spanId, activeSpan?.name, traceStateObj);
}
return null;
}
Expand Down Expand Up @@ -93,8 +93,8 @@
},
// Headers are not being used so custom properties will always be stubbed out
customProperties: {
getProperty(prop: string) { return "" },

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.x)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (18.x, x86)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (16.x, x86)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (20.x, x86)

'prop' is defined but never used

Check warning on line 96 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (22.x, x86)

'prop' is defined but never used
setProperty(prop: string) { return "" },

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.x)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20.x)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 16.x)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18.x)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (18.x, x86)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (16.x, x86)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (20.x, x86)

'prop' is defined but never used

Check warning on line 97 in src/shim/correlationContextManager.ts

View workflow job for this annotation

GitHub Actions / build (22.x, x86)

'prop' is defined but never used
} as ICustomProperties,
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@
trace.setSpanContext(context.active(), span.spanContext());
return this.spanToContextObject(
span.spanContext(),
span.parentSpanId,
span.parentSpanContext?.spanId,
);
}

Expand Down
29 changes: 20 additions & 9 deletions src/shim/telemetryClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { Attributes, context, metrics, ProxyTracerProvider, SpanKind, SpanOptions, SpanStatusCode, diag, trace } from "@opentelemetry/api";
import { Attributes, context, metrics, SpanKind, SpanOptions, SpanStatusCode, diag, trace } from "@opentelemetry/api";
import { logs } from "@opentelemetry/api-logs";
import { LoggerProvider } from "@opentelemetry/sdk-logs";
import {
SEMATTRS_DB_STATEMENT,
SEMATTRS_DB_SYSTEM,
Expand All @@ -21,7 +20,6 @@ import { Context } from "./context";
import { Util } from "../shared/util";
import Config = require("./shim-config");
import { AttributeSpanProcessor } from "../shared/util/attributeSpanProcessor";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { AttributeLogProcessor } from "../shared/util/attributeLogRecordProcessor";
import { LogApi } from "./logsApi";
import { flushAzureMonitor, shutdownAzureMonitor, useAzureMonitor } from "../main";
Expand Down Expand Up @@ -68,16 +66,29 @@ export class TelemetryClient {
this._isInitialized = true;
// Parse shim config to Azure Monitor options
this._options = this.config.parseConfig();
useAzureMonitor(this._options);

try {
// Create attribute processors with context tags and common properties
this._attributeSpanProcessor = new AttributeSpanProcessor({ ...this.context.tags, ...this.commonProperties });
this._attributeLogProcessor = new AttributeLogProcessor({ ...this.context.tags, ...this.commonProperties });

// Add processors to Azure Monitor options before initialization
if (!this._options.spanProcessors) {
this._options.spanProcessors = [];
}
this._options.spanProcessors.push(this._attributeSpanProcessor);

if (!this._options.logRecordProcessors) {
this._options.logRecordProcessors = [];
}
this._options.logRecordProcessors.push(this._attributeLogProcessor);

// Initialize Azure Monitor with processors included
useAzureMonitor(this._options);

// LoggerProvider would be initialized when client is instantiated
// Get Logger from global provider
this._logApi = new LogApi(logs.getLogger("ApplicationInsightsLogger"));
this._attributeSpanProcessor = new AttributeSpanProcessor({ ...this.context.tags, ...this.commonProperties });
((trace.getTracerProvider() as ProxyTracerProvider).getDelegate() as NodeTracerProvider).addSpanProcessor(this._attributeSpanProcessor);

this._attributeLogProcessor = new AttributeLogProcessor({ ...this.context.tags, ...this.commonProperties });
(logs.getLoggerProvider() as LoggerProvider).addLogRecordProcessor(this._attributeLogProcessor);

// Warn if any config warnings were generated during parsing
for (let i = 0; i < this._configWarnings.length; i++) {
Expand Down
14 changes: 11 additions & 3 deletions test/functionalTests/runner/testValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ module.exports.TestValidation = class TestValidation {

// Did we find all of the items in the data set?
if (dataSet.length > 1) {
Utils.Logging.error("FAILED EXPECTATION - Unexpected child telemetry item(s)!");
Utils.Logging.error(JSON.stringify(dataSet, null, 2));
hadFailed = true;
dataSet[0].data.baseData?.message
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line appears to be a dangling expression that serves no purpose. It should either be assigned to a variable, used in a condition, or removed.

Suggested change
dataSet[0].data.baseData?.message

Copilot uses AI. Check for mistakes.
dataSet.forEach(element => {
if (element?.data?.baseData?.message) {
const message = element.data.baseData.message;
if (!message.includes("Accessing resource attributes before async attributes settled []")) {
Utils.Logging.error("FAILED EXPECTATION - Unexpected child telemetry item(s)!");
Utils.Logging.error(JSON.stringify(dataSet, null, 2));
hadFailed = true;
}
}
});
}

// Report test status
Expand Down
4 changes: 2 additions & 2 deletions test/unitTests/agent/agentLoader.tests.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import * as sinon from "sinon";
import assert from "assert";
import sinon from "sinon";

import { AgentLoader } from "../../../src/agent/agentLoader";
import * as azureMonitor from "@azure/monitor-opentelemetry";
Expand Down
7 changes: 3 additions & 4 deletions test/unitTests/agent/aksLoader.tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as assert from "assert";
import * as sinon from "sinon";
import assert from "assert";
import sinon from "sinon";
import { ProxyTracerProvider, metrics, trace } from "@opentelemetry/api";
import { logs } from "@opentelemetry/api-logs";
import { AKSLoader } from "../../../src/agent/aksLoader";
Expand Down Expand Up @@ -54,11 +54,10 @@ describe("agent/AKSLoader", () => {
assert.equal(meterProvider.constructor.name, "MeterProvider");
assert.equal(meterProvider["_sharedState"]["metricCollectors"].length, 1);
assert.equal(meterProvider["_sharedState"]["metricCollectors"][0]["_metricReader"]["_exporter"].constructor.name, "AzureMonitorMetricExporter");

let tracerProvider = ((trace.getTracerProvider() as ProxyTracerProvider).getDelegate()) as any;
assert.equal(tracerProvider.constructor.name, "NodeTracerProvider");
assert.equal(tracerProvider["_registeredSpanProcessors"][2]["_exporter"].constructor.name, "AzureMonitorTraceExporter");
let loggerProvider = logs.getLoggerProvider() as any;
assert.equal(loggerProvider.constructor.name, "LoggerProvider");
assert.equal(loggerProvider["_sharedState"]["registeredLogRecordProcessors"][1]["_exporter"].constructor.name, "AzureMonitorLogExporter");
});
});
Loading
Loading