Skip to content

Commit

Permalink
Simplify code (open-telemetry#2491)
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Oct 18, 2021
1 parent d119447 commit 84bdf38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
35 changes: 0 additions & 35 deletions src/OpenTelemetry/Metrics/DropConfiguration.cs

This file was deleted.

9 changes: 9 additions & 0 deletions src/OpenTelemetry/Metrics/MetricStreamConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@ public class MetricStreamConfiguration
public virtual Aggregation Aggregation { get; set; }

// TODO: MetricPoints caps can be configured here

private sealed class DropConfiguration : MetricStreamConfiguration
{
public override Aggregation Aggregation
{
get => Aggregation.Drop;
set { }
}
}
}
}
3 changes: 2 additions & 1 deletion test/OpenTelemetry.Tests/Metrics/MetricViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ public void ViewToDropAndRetainInstrument()
[Fact]
public void MetricStreamConfigurationForDropMustNotAllowOverriding()
{
Assert.Throws<ArgumentException>(() => MetricStreamConfiguration.Drop.Aggregation = Aggregation.Histogram);
MetricStreamConfiguration.Drop.Aggregation = Aggregation.Histogram;
Assert.Equal(Aggregation.Drop, MetricStreamConfiguration.Drop.Aggregation);
}
}
#pragma warning restore SA1000 // KeywordsMustBeSpacedCorrectly
Expand Down

0 comments on commit 84bdf38

Please sign in to comment.