diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreMetricsInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreMetricsInstrumentationOptions.cs index 5caea51b59e..e43b7db331b 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreMetricsInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/AspNetCoreMetricsInstrumentationOptions.cs @@ -1,4 +1,4 @@ -// +// // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs index 181a7d57e5f..1e0f8b8da18 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs @@ -34,11 +34,11 @@ namespace OpenTelemetry.Instrumentation.AspNetCore.Tests public class MetricTests : IClassFixture>, IDisposable { - private readonly WebApplicationFactory factory; - private MeterProvider meterProvider = null; - private const int StandardTagsCount = 6; + private readonly WebApplicationFactory factory; + private MeterProvider meterProvider; + public MetricTests(WebApplicationFactory factory) { this.factory = factory; @@ -197,6 +197,12 @@ void ConfigureTestServices(IServiceCollection services) Assert.Contains(tagsToAdd[1], tags); } + public void Dispose() + { + this.meterProvider?.Dispose(); + GC.SuppressFinalize(this); + } + private static List GetMetricPoints(Metric metric) { Assert.NotNull(metric); @@ -210,9 +216,7 @@ private static List GetMetricPoints(Metric metric) return metricPoints; } - private static KeyValuePair[] AssertMetricPoint(MetricPoint metricPoint, - string expectedRoute = "api/Values", - int expectedTagsCount = StandardTagsCount) + private static KeyValuePair[] AssertMetricPoint(MetricPoint metricPoint, string expectedRoute = "api/Values", int expectedTagsCount = StandardTagsCount) { var count = metricPoint.GetHistogramCount(); var sum = metricPoint.GetHistogramSum(); @@ -253,11 +257,5 @@ private static KeyValuePair[] AssertMetricPoint(MetricPoint metr return attributes; } - - public void Dispose() - { - this.meterProvider?.Dispose(); - GC.SuppressFinalize(this); - } } }