Skip to content

Commit 9993051

Browse files
author
Timothy Mothra
authored
Update opentelemetry-add-modify.md
1 parent 330fdd5 commit 9993051

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

articles/azure-monitor/app/opentelemetry-add-modify.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ The following example demonstrates how the [Runtime Instrumentation](https://www
229229

230230
```csharp
231231
// Create a new OpenTelemetry meter provider and add runtime instrumentation and the Azure Monitor metric exporter.
232+
// It is important to keep the MetricsProvider instance active throughout the process lifetime.
232233
var metricsProvider = Sdk.CreateMeterProviderBuilder()
233234
.AddRuntimeInstrumentation()
234235
.AddAzureMonitorMetricExporter();
@@ -415,6 +416,8 @@ public class Program
415416
// Create a new MeterProvider object using the OpenTelemetry SDK.
416417
// The MeterProvider object is responsible for managing meters and sending
417418
// metric data to exporters.
419+
// It is important to keep the MetricsProvider instance active
420+
// throughout the process lifetime.
418421
//
419422
// The MeterProviderBuilder is configured to add a meter named
420423
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -559,6 +562,8 @@ public class Program
559562
// Create a new MeterProvider object using the OpenTelemetry SDK.
560563
// The MeterProvider object is responsible for managing meters and sending
561564
// metric data to exporters.
565+
// It is important to keep the MetricsProvider instance active
566+
// throughout the process lifetime.
562567
//
563568
// The MeterProviderBuilder is configured to add a meter named
564569
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -712,7 +717,9 @@ public class Program
712717
{
713718
// Create a new MeterProvider object using the OpenTelemetry SDK.
714719
// The MeterProvider object is responsible for managing meters and sending
715-
// metric data to exporters.
720+
// metric data to exporters.
721+
// It is important to keep the MetricsProvider instance active
722+
// throughout the process lifetime.
716723
//
717724
// The MeterProviderBuilder is configured to add a meter named
718725
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -1047,6 +1054,7 @@ app.Run();
10471054
10481055
```csharp
10491056
// Create an OpenTelemetry tracer provider builder.
1057+
// It is important to keep the TracerProvider instance active throughout the process lifetime.
10501058
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
10511059
.AddSource("ActivitySourceName")
10521060
.AddAzureMonitorTraceExporter()
@@ -1453,6 +1461,7 @@ To add span attributes, use either of the following two ways:
14531461
14541462
```csharp
14551463
// Create an OpenTelemetry tracer provider builder.
1464+
// It is important to keep the TracerProvider instance active throughout the process lifetime.
14561465
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
14571466
// Add a source named "OTel.AzureMonitor.Demo".
14581467
.AddSource("OTel.AzureMonitor.Demo") // Add a new processor named ActivityEnrichingProcessor.
@@ -1812,6 +1821,7 @@ You might use the following ways to filter out telemetry before it leaves your a
18121821

18131822
```csharp
18141823
// Create an OpenTelemetry tracer provider builder.
1824+
// It is important to keep the TracerProvider instance active throughout the process lifetime.
18151825
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
18161826
.AddSource("OTel.AzureMonitor.Demo") // Add a source named "OTel.AzureMonitor.Demo".
18171827
.AddProcessor(new ActivityFilteringProcessor()) // Add a new processor named ActivityFilteringProcessor.

0 commit comments

Comments
 (0)