Skip to content

Commit 1d2543d

Browse files
committed
Update config
1 parent b9db0f1 commit 1d2543d

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

articles/azure-monitor/app/opentelemetry-configuration.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -783,22 +783,18 @@ For more information about Java, see the [Java supplemental documentation](java-
783783
```typescript
784784
// Import the useAzureMonitor function, the AzureMonitorOpenTelemetryOptions class, the trace module, the ProxyTracerProvider class, the BatchSpanProcessor class, the NodeTracerProvider class, and the OTLPTraceExporter class from the @azure/monitor-opentelemetry, @opentelemetry/api, @opentelemetry/sdk-trace-base, @opentelemetry/sdk-trace-node, and @opentelemetry/exporter-trace-otlp-http packages, respectively.
785785
const { useAzureMonitor, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
786-
const { trace, ProxyTracerProvider } = require("@opentelemetry/api");
787786
const { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base');
788-
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
789787
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
790788

791-
// Enable Azure Monitor integration.
792-
useAzureMonitor();
793-
794789
// Create a new OTLPTraceExporter object.
795790
const otlpExporter = new OTLPTraceExporter();
796791

797-
// Get the NodeTracerProvider instance.
798-
const tracerProvider = ((trace.getTracerProvider() as ProxyTracerProvider).getDelegate() as NodeTracerProvider);
799-
800-
// Add a BatchSpanProcessor to the NodeTracerProvider instance.
801-
tracerProvider.addSpanProcessor(new BatchSpanProcessor(otlpExporter));
792+
// Enable Azure Monitor integration.
793+
const options: AzureMonitorOpenTelemetryOptions = {
794+
// Add the SpanEnrichingProcessor
795+
spanProcessors: [new BatchSpanProcessor(otlpExporter)]
796+
}
797+
useAzureMonitor(options);
802798
```
803799

804800
#### [Python](#tab/python)

0 commit comments

Comments
 (0)