@@ -229,6 +229,7 @@ The following example demonstrates how the [Runtime Instrumentation](https://www
229
229
230
230
``` csharp
231
231
// 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.
232
233
var metricsProvider = Sdk .CreateMeterProviderBuilder ()
233
234
.AddRuntimeInstrumentation ()
234
235
.AddAzureMonitorMetricExporter ();
@@ -415,6 +416,8 @@ public class Program
415
416
// Create a new MeterProvider object using the OpenTelemetry SDK.
416
417
// The MeterProvider object is responsible for managing meters and sending
417
418
// metric data to exporters.
419
+ // It is important to keep the MetricsProvider instance active
420
+ // throughout the process lifetime.
418
421
//
419
422
// The MeterProviderBuilder is configured to add a meter named
420
423
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -559,6 +562,8 @@ public class Program
559
562
// Create a new MeterProvider object using the OpenTelemetry SDK.
560
563
// The MeterProvider object is responsible for managing meters and sending
561
564
// metric data to exporters.
565
+ // It is important to keep the MetricsProvider instance active
566
+ // throughout the process lifetime.
562
567
//
563
568
// The MeterProviderBuilder is configured to add a meter named
564
569
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -712,7 +717,9 @@ public class Program
712
717
{
713
718
// Create a new MeterProvider object using the OpenTelemetry SDK.
714
719
// 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.
716
723
//
717
724
// The MeterProviderBuilder is configured to add a meter named
718
725
// "OTel.AzureMonitor.Demo" and an Azure Monitor metric exporter.
@@ -1047,6 +1054,7 @@ app.Run();
1047
1054
1048
1055
``` csharp
1049
1056
// Create an OpenTelemetry tracer provider builder.
1057
+ // It is important to keep the TracerProvider instance active throughout the process lifetime.
1050
1058
using var tracerProvider = Sdk .CreateTracerProviderBuilder ()
1051
1059
.AddSource (" ActivitySourceName" )
1052
1060
.AddAzureMonitorTraceExporter ()
@@ -1453,6 +1461,7 @@ To add span attributes, use either of the following two ways:
1453
1461
1454
1462
``` csharp
1455
1463
// Create an OpenTelemetry tracer provider builder.
1464
+ // It is important to keep the TracerProvider instance active throughout the process lifetime.
1456
1465
using var tracerProvider = Sdk .CreateTracerProviderBuilder ()
1457
1466
// Add a source named "OTel.AzureMonitor.Demo".
1458
1467
.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
1812
1821
1813
1822
```csharp
1814
1823
// Create an OpenTelemetry tracer provider builder.
1824
+ // It is important to keep the TracerProvider instance active throughout the process lifetime.
1815
1825
using var tracerProvider = Sdk .CreateTracerProviderBuilder ()
1816
1826
.AddSource (" OTel.AzureMonitor.Demo" ) // Add a source named "OTel.AzureMonitor.Demo".
1817
1827
.AddProcessor (new ActivityFilteringProcessor ()) // Add a new processor named ActivityFilteringProcessor.
0 commit comments