Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature-basic-metrics…
Browse files Browse the repository at this point in the history
…-options-support
Temppus committed Dec 1, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents d6b0126 + 67b7c7a commit 09c7e85
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AspNetCoreInstrumentationOptions.cs" company="OpenTelemetry Authors">
// <copyright file="AspNetCoreMetricsInstrumentationOptions.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
22 changes: 10 additions & 12 deletions test/OpenTelemetry.Instrumentation.AspNetCore.Tests/MetricTests.cs
Original file line number Diff line number Diff line change
@@ -34,11 +34,11 @@ namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
public class MetricTests
: IClassFixture<WebApplicationFactory<Program>>, IDisposable
{
private readonly WebApplicationFactory<Program> factory;
private MeterProvider meterProvider = null;

private const int StandardTagsCount = 6;

private readonly WebApplicationFactory<Program> factory;
private MeterProvider meterProvider;

public MetricTests(WebApplicationFactory<Program> 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<MetricPoint> GetMetricPoints(Metric metric)
{
Assert.NotNull(metric);
@@ -210,9 +216,7 @@ private static List<MetricPoint> GetMetricPoints(Metric metric)
return metricPoints;
}

private static KeyValuePair<string, object>[] AssertMetricPoint(MetricPoint metricPoint,
string expectedRoute = "api/Values",
int expectedTagsCount = StandardTagsCount)
private static KeyValuePair<string, object>[] 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<string, object>[] AssertMetricPoint(MetricPoint metr

return attributes;
}

public void Dispose()
{
this.meterProvider?.Dispose();
GC.SuppressFinalize(this);
}
}
}

0 comments on commit 09c7e85

Please sign in to comment.