@@ -354,7 +354,7 @@ Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
354
354
Counter < long > AnotherFruitCounter = MyMeter .CreateCounter <long >(" AnotherFruitCounter" );
355
355
356
356
using var meterProvider = Sdk .CreateMeterProviderBuilder ()
357
- .AddMeter (" * " )
357
+ .AddMeter (" MyCompany.MyProduct.MyLibrary " )
358
358
.AddConsoleExporter ()
359
359
.SetMaxMetricStreams (1 ) // The default value is 1000
360
360
.Build ();
@@ -367,11 +367,31 @@ MyFruitCounter.Add(1, new("name", "apple"), new("color", "red"));
367
367
AnotherFruitCounter .Add (1 , new (" name" , " apple" ), new (" color" , " red" ));
368
368
```
369
369
370
+ ### Changing the cardinality limit for a MeterProvider
371
+
372
+ To set the default [ cardinality limit] ( ../README.md#cardinality-limits ) for all
373
+ metrics managed by a given ` MeterProvider ` , use the
374
+ ` MeterProviderBuilder.SetMaxMetricPointsPerMetricStream ` extension:
375
+
376
+ > [ !CAUTION]
377
+ > ` MeterProviderBuilder.SetMaxMetricPointsPerMetricStream ` is marked ` Obsolete `
378
+ in pre-release builds and has been replaced by
379
+ ` MetricStreamConfiguration.CardinalityLimit ` . For details see:
380
+ [ OTEL1003] ( ../../diagnostics/experimental-apis/OTEL1003.md ) .
381
+
382
+ ``` csharp
383
+ using var meterProvider = Sdk .CreateMeterProviderBuilder ()
384
+ .AddMeter (" MyCompany.MyProduct.MyLibrary" )
385
+ .SetMaxMetricPointsPerMetricStream (4000 ) // Note: The default value is 2000
386
+ .AddConsoleExporter ()
387
+ .Build ();
388
+ ```
389
+
370
390
### Changing the cardinality limit for a Metric
371
391
372
392
To set the [ cardinality limit] ( ../README.md#cardinality-limits ) for an
373
- individual metric, use ` MetricStreamConfiguration.CardinalityLimit ` setting on
374
- the View API:
393
+ individual metric, use the ` MetricStreamConfiguration.CardinalityLimit ` property
394
+ on the View API:
375
395
376
396
> [ !NOTE]
377
397
> ` MetricStreamConfiguration.CardinalityLimit ` is an experimental API only
0 commit comments