Skip to content

Commit

Permalink
Merge branch 'main' into reyang/bump-Microsoft.Extensions.Telemetry.A…
Browse files Browse the repository at this point in the history
…bstractions
  • Loading branch information
CodeBlanch authored Feb 15, 2024
2 parents a692e32 + 99a394c commit c542dbc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/metrics/customizing-the-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,9 @@ Histograms with buckets, and it stores at most one exemplar per histogram
bucket. The exemplar stored is the last measurement recorded - i.e. any new
measurement overwrites the previous one in that bucket.

* `SimpleExemplarReservoir` is the default reservoir used for all metrics except
Histograms with buckets. It has a fixed reservoir pool, and implements the
equivalent of [naive
* `SimpleFixedSizeExemplarReservoir` is the default reservoir used for all
metrics except Histograms with buckets. It has a fixed reservoir pool, and
implements the equivalent of [naive
reservoir](https://en.wikipedia.org/wiki/Reservoir_sampling). The reservoir pool
size (currently defaulting to 1) determines the maximum number of exemplars
stored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
namespace OpenTelemetry.Metrics;

/// <summary>
/// The SimpleExemplarReservoir implementation.
/// The SimpleFixedSizeExemplarReservoir implementation.
/// </summary>
internal sealed class SimpleExemplarReservoir : ExemplarReservoir
internal sealed class SimpleFixedSizeExemplarReservoir : ExemplarReservoir
{
private readonly int poolSize;
private readonly Random random;
Expand All @@ -17,7 +17,7 @@ internal sealed class SimpleExemplarReservoir : ExemplarReservoir

private long measurementsSeen;

public SimpleExemplarReservoir(int poolSize)
public SimpleFixedSizeExemplarReservoir(int poolSize)
{
this.poolSize = poolSize;
this.runningExemplars = new Exemplar[poolSize];
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry/Metrics/MetricPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal MetricPoint(

if (aggregatorStore!.IsExemplarEnabled() && reservoir == null)
{
reservoir = new SimpleExemplarReservoir(DefaultSimpleReservoirPoolSize);
reservoir = new SimpleFixedSizeExemplarReservoir(DefaultSimpleReservoirPoolSize);
}

if (reservoir != null)
Expand Down
2 changes: 1 addition & 1 deletion test/OpenTelemetry.Tests/Metrics/MetricExemplarTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void TestExemplarsCounter(MetricReaderTemporalityPreference temporality)
var exemplars = GetExemplars(metricPoint.Value);

// TODO: Modify the test to better test cumulative.
// In cumulative where SimpleExemplarReservoir's size is
// In cumulative, where SimpleFixedSizeExemplarReservoir's size is
// more than the count of new measurements, it is possible
// that the exemplar value is for a measurement that was recorded in the prior
// cycle. The current ValidateExemplars() does not handle this case.
Expand Down

0 comments on commit c542dbc

Please sign in to comment.