Skip to content

Commit

Permalink
minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
samlam committed Sep 1, 2023
1 parent e5ebe25 commit 813d4ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions src/OpenTelemetry/Metrics/AggregatorStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ internal sealed class AggregatorStore
{
private static readonly string MetricPointCapHitFixMessage = "Consider opting in for the experimental SDK feature to emit all the throttled metrics under the overflow attribute by setting env variable OTEL_DOTNET_EXPERIMENTAL_METRICS_EMIT_OVERFLOW_ATTRIBUTE = true. You could also modify instrumentation to reduce the number of unique key/value pair combinations. Or use Views to drop unwanted tags. Or use MeterProviderBuilder.SetMaxMetricPointsPerMetricStream to set higher limit.";
private static readonly Comparison<KeyValuePair<string, object>> DimensionComparisonDelegate = (x, y) => x.Key.CompareTo(y.Key);
private static readonly Dictionary<(string, string), double[]> DefaultHistogramBoundMappings = new()
private static readonly IReadOnlyDictionary<(string, string), double[]> DefaultHistogramBoundMappings = new Dictionary<(string, string), double[]>()
{
{ ("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request_lease.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request.time_in_queue"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.connection.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.request.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.request.time_in_queue"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.Hosting", "http.server.request.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.Http.Connections", "signalr.server.connection.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request.time_in_queue"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request_lease.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.Server.Kestrel", "kestrel.connection.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.Server.Kestrel", "kestrel.tls_handshake.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("Microsoft.AspNetCore.Http.Connections", "signalr.server.connection.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.NameResolution", "dns.lookups.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("OpenTelemetry.Instrumentation.AspNetCore", "http.server.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("OpenTelemetry.Instrumentation.Http", "http.client.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.connection.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.request.duration"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.Http", "http.client.request.time_in_queue"), Metric.DefaultHistogramBoundsSeconds },
{ ("System.Net.NameResolution", "dns.lookups.duration"), Metric.DefaultHistogramBoundsSeconds },
};

private readonly object lockZeroTags = new();
Expand Down
12 changes: 6 additions & 6 deletions test/OpenTelemetry.Tests/Metrics/AggregatorTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,18 @@ public void MultiThreadedHistogramUpdateAndSnapShotTest()
}

[Theory]
[InlineData("Microsoft.AspNetCore.Hosting", "http.server.request.duration")]
[InlineData("Microsoft.AspNetCore.Http.Connections", "signalr.server.connection.duration")]
[InlineData("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request_lease.duration")]
[InlineData("Microsoft.AspNetCore.RateLimiting", "aspnetcore.rate_limiting.request.time_in_queue")]
[InlineData("System.Net.Http", "http.client.connection.duration")]
[InlineData("System.Net.Http", "http.client.request.duration")]
[InlineData("System.Net.Http", "http.client.request.time_in_queue")]
[InlineData("Microsoft.AspNetCore.Hosting", "http.server.request.duration")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "kestrel.connection.duration")]
[InlineData("Microsoft.AspNetCore.Server.Kestrel", "kestrel.tls_handshake.duration")]
[InlineData("Microsoft.AspNetCore.Http.Connections", "signalr.server.connection.duration")]
[InlineData("System.Net.NameResolution", "dns.lookups.duration")]
[InlineData("OpenTelemetry.Instrumentation.AspNetCore", "http.server.duration")]
[InlineData("OpenTelemetry.Instrumentation.Http", "http.client.duration")]
[InlineData("System.Net.Http", "http.client.connection.duration")]
[InlineData("System.Net.Http", "http.client.request.duration")]
[InlineData("System.Net.Http", "http.client.request.time_in_queue")]
[InlineData("System.Net.NameResolution", "dns.lookups.duration")]
public void HistogramBucketsDefaultUpdatesForSecondsTest(string meterName, string instrumentName)
{
RunTest(meterName, instrumentName, unit: "s");
Expand Down

0 comments on commit 813d4ff

Please sign in to comment.