@@ -272,15 +272,17 @@ The sampler expects a sample rate of between 0 and 1 inclusive. A rate of 0.1 me
272
272
273
273
In this example , we utilize the `ApplicationInsightsSampler `, which offers compatibility with Application Insights SDKs .
274
274
275
- ```dotnetcli
276
- dotnet add package -- prerelease OpenTelemetry .Extensions .AzureMonitor
277
- ```
275
+ 1 . Install the latest [OpenTelemetry .Extensions .AzureMonitor ](https :// www.nuget.org/packages/OpenTelemetry.Extensions.AzureMonitor) package:
276
+ ```dotnetcli
277
+ dotnet add package -- prerelease OpenTelemetry .Extensions .AzureMonitor
278
+ ```
278
279
279
- ```csharp
280
- var tracerProvider = Sdk .CreateTracerProviderBuilder ()
281
- .SetSampler (new ApplicationInsightsSampler (new ApplicationInsightsSamplerOptions { SamplingRatio = 1 . 0 F }))
282
- .AddAzureMonitorTraceExporter ();
283
- ```
280
+ 1 . Add the following code snippet .
281
+ ```csharp
282
+ var tracerProvider = Sdk .CreateTracerProviderBuilder ()
283
+ .SetSampler (new ApplicationInsightsSampler (new ApplicationInsightsSamplerOptions { SamplingRatio = 0 . 1 F }))
284
+ .AddAzureMonitorTraceExporter ();
285
+ ```
284
286
285
287
#### [Java](#tab/java)
286
288
@@ -327,17 +329,23 @@ We support the credential classes provided by [Azure Identity](https://github.co
327
329
- We recommend `ClientSecretCredential ` for service principals .
328
330
- Provide the tenant ID , client ID , and client secret to the constructor .
329
331
330
- ```csharp
331
- var builder = WebApplication .CreateBuilder (args );
332
+ 1 . Install the latest [Azure .Identity ](https :// www.nuget.org/packages/Azure.Identity) package:
333
+ ```dotnetcli
334
+ dotnet add package Azure .Identity
335
+ ```
336
+
337
+ 1 . Provide the desired credential class :
338
+ ```csharp
339
+ var builder = WebApplication .CreateBuilder (args );
332
340
333
- builder .Services .AddOpenTelemetry ().UseAzureMonitor (options => {
334
- options .Credential = new DefaultAzureCredential ();
335
- });
341
+ builder .Services .AddOpenTelemetry ().UseAzureMonitor (options => {
342
+ options .Credential = new DefaultAzureCredential ();
343
+ });
336
344
337
- var app = builder .Build ();
345
+ var app = builder .Build ();
338
346
339
- app .Run ();
340
- ```
347
+ app .Run ();
348
+ ```
341
349
342
350
#### [.NET](#tab/net)
343
351
@@ -350,32 +358,38 @@ We support the credential classes provided by [Azure Identity](https://github.co
350
358
- We recommend `ClientSecretCredential ` for service principals .
351
359
- Provide the tenant ID , client ID , and client secret to the constructor .
352
360
353
- ```csharp
354
- var credential = new DefaultAzureCredential ();
361
+ 1 . Install the latest [Azure .Identity ](https :// www.nuget.org/packages/Azure.Identity) package:
362
+ ```dotnetcli
363
+ dotnet add package Azure .Identity
364
+ ```
355
365
356
- var tracerProvider = Sdk .CreateTracerProviderBuilder ()
357
- .AddAzureMonitorTraceExporter (options =>
358
- {
359
- options .Credential = credential ;
360
- });
366
+ 1 . Provide the desired credential class :
367
+ ```csharp
368
+ var credential = new DefaultAzureCredential ();
361
369
362
- var metricsProvider = Sdk .CreateMeterProviderBuilder ()
363
- . AddAzureMonitorMetricExporter (options =>
364
- {
365
- options .Credential = credential ;
366
- });
370
+ var tracerProvider = Sdk .CreateTracerProviderBuilder ()
371
+ . AddAzureMonitorTraceExporter (options =>
372
+ {
373
+ options .Credential = credential ;
374
+ });
367
375
368
- var loggerFactory = LoggerFactory .Create (builder =>
369
- {
370
- builder .AddOpenTelemetry (options =>
371
- {
372
- options .AddAzureMonitorLogExporter (options =>
376
+ var metricsProvider = Sdk .CreateMeterProviderBuilder ()
377
+ .AddAzureMonitorMetricExporter (options =>
373
378
{
374
379
options .Credential = credential ;
375
380
});
381
+
382
+ var loggerFactory = LoggerFactory .Create (builder =>
383
+ {
384
+ builder .AddOpenTelemetry (options =>
385
+ {
386
+ options .AddAzureMonitorLogExporter (options =>
387
+ {
388
+ options .Credential = credential ;
389
+ });
390
+ });
376
391
});
377
- });
378
- ```
392
+ ```
379
393
380
394
#### [Java](#tab/java)
381
395
0 commit comments