Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] fixing InMemoryExporter & Metrics bug. new class: ExportableMetricCopy. new ctor: InMemoryExporter(Func) #3198

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6d1a88c
implementation
TimothyMothra Apr 15, 2022
e8a496c
OpenTelemetry.Tests
TimothyMothra Apr 15, 2022
be840b5
OpenTelemetry.Instrumentation.Http.Tests
TimothyMothra Apr 15, 2022
26c0d4a
OpenTelemetry.Instrumentation.AspNetCore.Tests
TimothyMothra Apr 15, 2022
9fbc304
OpenTelemetry.Instrumentation.AspNet.Tests
TimothyMothra Apr 15, 2022
be30a48
Benchmarks
TimothyMothra Apr 15, 2022
9e09be3
sort alphabetically
TimothyMothra Apr 15, 2022
357b3a3
more OpenTelemetry.Tests
TimothyMothra Apr 16, 2022
c75dc01
fix public api
TimothyMothra Apr 16, 2022
c8cbd0a
Merge branch 'main' into 2361_ExportableMetricCopy
cijothomas Apr 18, 2022
1a28ae7
remove extension methods that created InMemoryExporter<Metric>.
TimothyMothra Apr 20, 2022
ed66ad5
Merge branch '2361_ExportableMetricCopy' of https://github.com/Timoth…
TimothyMothra Apr 20, 2022
a7641c4
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 20, 2022
6d40549
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 20, 2022
26d7e1f
merge conflict: fix test
TimothyMothra Apr 20, 2022
9a0d99a
addressing code review feedback; cleanup and removing boilerplate
TimothyMothra Apr 21, 2022
3a59585
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 21, 2022
f2b2062
change to internal
TimothyMothra Apr 21, 2022
8c06f94
removed change to Batch
TimothyMothra Apr 21, 2022
5850db8
cleanup
TimothyMothra Apr 21, 2022
493520b
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 21, 2022
0027a4d
add extension class to tests.shared
TimothyMothra Apr 22, 2022
365b8cc
Merge branch '2361_ExportableMetricCopy' of https://github.com/Timoth…
TimothyMothra Apr 22, 2022
ec7ee18
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 22, 2022
f68b76e
cleanup
TimothyMothra Apr 22, 2022
42e4854
cleanup
TimothyMothra Apr 22, 2022
afb1d86
additional unit test
TimothyMothra Apr 22, 2022
cd5f68d
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 22, 2022
fb94b9a
failure exporter
TimothyMothra Apr 22, 2022
334779f
Merge branch '2361_ExportableMetricCopy' of https://github.com/Timoth…
TimothyMothra Apr 22, 2022
8dc80e6
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 22, 2022
054400d
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 25, 2022
534c674
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 26, 2022
3141ec3
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra Apr 28, 2022
942e952
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra May 4, 2022
e40acc5
Merge branch 'main' into 2361_ExportableMetricCopy
cijothomas May 5, 2022
38f0b6d
Merge branch 'main' into 2361_ExportableMetricCopy
TimothyMothra May 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
OpenTelemetry.Exporter.InMemoryExporter<T>.AdditionalExportAction.get -> System.Action<T>
OpenTelemetry.Exporter.InMemoryExporter<T>.AdditionalExportAction.set -> void
OpenTelemetry.Exporter.InMemoryMetricExporter
OpenTelemetry.Exporter.InMemoryMetricExporter.InMemoryMetricExporter(System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportedMetric> exportedItems) -> void
OpenTelemetry.Metrics.ExportableMetricCopy
OpenTelemetry.Metrics.ExportableMetricCopy.Description.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MeterName.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MeterVersion.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MetricPoints.get -> System.Collections.Generic.IReadOnlyList<OpenTelemetry.Metrics.MetricPoint>
OpenTelemetry.Metrics.ExportableMetricCopy.MetricType.get -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.ExportableMetricCopy.Name.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.Unit.get -> string
OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions
override OpenTelemetry.Exporter.InMemoryMetricExporter.Export(in OpenTelemetry.Batch<OpenTelemetry.Metrics.Metric> batch) -> OpenTelemetry.ExportResult
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportableMetricCopy> exportedItems) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportableMetricCopy> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
OpenTelemetry.Exporter.InMemoryExporter<T>.AdditionalExportAction.get -> System.Action<T>
OpenTelemetry.Exporter.InMemoryExporter<T>.AdditionalExportAction.set -> void
OpenTelemetry.Exporter.InMemoryMetricExporter
OpenTelemetry.Exporter.InMemoryMetricExporter.InMemoryMetricExporter(System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportedMetric> exportedItems) -> void
OpenTelemetry.Metrics.ExportableMetricCopy
OpenTelemetry.Metrics.ExportableMetricCopy.Description.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MeterName.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MeterVersion.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.MetricPoints.get -> System.Collections.Generic.IReadOnlyList<OpenTelemetry.Metrics.MetricPoint>
OpenTelemetry.Metrics.ExportableMetricCopy.MetricType.get -> OpenTelemetry.Metrics.MetricType
OpenTelemetry.Metrics.ExportableMetricCopy.Name.get -> string
OpenTelemetry.Metrics.ExportableMetricCopy.Unit.get -> string
OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions
override OpenTelemetry.Exporter.InMemoryMetricExporter.Export(in OpenTelemetry.Batch<OpenTelemetry.Metrics.Metric> batch) -> OpenTelemetry.ExportResult
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportableMetricCopy> exportedItems) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.ExportableMetricCopy> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
static OpenTelemetry.Metrics.InMemoryExporterMetricsExtensions.AddInMemoryExporter(this OpenTelemetry.Metrics.MeterProviderBuilder builder, System.Collections.Generic.ICollection<OpenTelemetry.Metrics.Metric> exportedItems, System.Action<OpenTelemetry.Metrics.MetricReaderOptions> configureMetricReader) -> OpenTelemetry.Metrics.MeterProviderBuilder
58 changes: 58 additions & 0 deletions src/OpenTelemetry.Exporter.InMemory/ExportableMetricCopy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// <copyright file="ExportableMetricCopy.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System.Collections.Generic;

namespace OpenTelemetry.Metrics
{
/// <summary>
/// This class represents a selective copy of <see cref="Metric"/>.
/// This contains the minimum fields and properties needed for most
/// unit testing scenarios.
/// </summary>
public class ExportableMetricCopy
{
private readonly MetricStreamIdentity instrumentIdentity;

internal ExportableMetricCopy(Metric metric)
{
this.instrumentIdentity = metric.InstrumentIdentity;
this.MetricType = metric.MetricType;

List<MetricPoint> metricPoints = new();
foreach (ref readonly var metricPoint in metric.GetMetricPoints())
{
metricPoints.Add(metricPoint.Copy());
}

this.MetricPoints = metricPoints;
}

public string Name => this.instrumentIdentity.InstrumentName;

public string Description => this.instrumentIdentity.Description;

public string Unit => this.instrumentIdentity.Unit;

public string MeterName => this.instrumentIdentity.MeterName;

public MetricType MetricType { get; }

public string MeterVersion => this.instrumentIdentity.MeterVersion;

public IReadOnlyList<MetricPoint> MetricPoints { get; }
}
}
9 changes: 7 additions & 2 deletions src/OpenTelemetry.Exporter.InMemory/InMemoryExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
// </copyright>

using System;
using System.Collections.Generic;

namespace OpenTelemetry.Exporter
Expand All @@ -28,16 +29,20 @@ public InMemoryExporter(ICollection<T> exportedItems)
this.exportedItems = exportedItems;
}

public Action<T> AdditionalExportAction { get; set; }

public override ExportResult Export(in Batch<T> batch)
{
if (this.exportedItems == null)
if (this.exportedItems == null && this.AdditionalExportAction == null)
{
return ExportResult.Failure;
}

foreach (var data in batch)
{
this.exportedItems.Add(data);
this.exportedItems?.Add(data);

this.AdditionalExportAction?.Invoke(data);
}

return ExportResult.Success;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public static class InMemoryExporterMetricsExtensions
/// <param name="builder"><see cref="MeterProviderBuilder"/> builder to use.</param>
/// <param name="exportedItems">Collection which will be populated with the exported MetricItem.</param>
/// <returns>The instance of <see cref="MeterProviderBuilder"/> to chain the calls.</returns>
/// <remarks>Note that when working with <see cref="Metric"/> these objects are not deep-cloned,
/// and repeated flushes may introduce duplicates.
/// If you need deep-cloned it is recommended to use <see cref="ExportableMetricCopy"/>.
/// </remarks>
public static MeterProviderBuilder AddInMemoryExporter(this MeterProviderBuilder builder, ICollection<Metric> exportedItems)
reyang marked this conversation as resolved.
Show resolved Hide resolved
{
Guard.ThrowIfNull(builder);
Expand All @@ -59,7 +63,62 @@ public static MeterProviderBuilder AddInMemoryExporter(this MeterProviderBuilder
/// <param name="exportedItems">Collection which will be populated with the exported MetricItem.</param>
/// <param name="configureMetricReader"><see cref="MetricReader"/> configuration options.</param>
/// <returns>The instance of <see cref="MeterProviderBuilder"/> to chain the calls.</returns>
public static MeterProviderBuilder AddInMemoryExporter(this MeterProviderBuilder builder, ICollection<Metric> exportedItems, Action<MetricReaderOptions> configureMetricReader)
/// <remarks>Note that when working with <see cref="Metric"/> these objects are not deep-cloned,
/// and repeated flushes may introduce duplicates.
/// If you need deep-cloned it is recommended to use <see cref="ExportableMetricCopy"/>.
/// </remarks>
public static MeterProviderBuilder AddInMemoryExporter(
this MeterProviderBuilder builder,
ICollection<Metric> exportedItems,
Action<MetricReaderOptions> configureMetricReader)
{
Guard.ThrowIfNull(builder);
Guard.ThrowIfNull(exportedItems);

if (builder is IDeferredMeterProviderBuilder deferredMeterProviderBuilder)
{
return deferredMeterProviderBuilder.Configure((sp, builder) =>
{
AddInMemoryExporter(builder, exportedItems, sp.GetOptions<MetricReaderOptions>(), configureMetricReader);
});
}

return AddInMemoryExporter(builder, exportedItems, new MetricReaderOptions(), configureMetricReader);
}

/// <summary>
/// Adds InMemory metric exporter to the <see cref="MeterProviderBuilder"/> using default options.
/// </summary>
/// <param name="builder"><see cref="MeterProviderBuilder"/> builder to use.</param>
/// <param name="exportedItems">Collection which will be populated with the exported MetricItem represented as <see cref="ExportableMetricCopy"/>.</param>
/// <returns>The instance of <see cref="MeterProviderBuilder"/> to chain the calls.</returns>
public static MeterProviderBuilder AddInMemoryExporter(this MeterProviderBuilder builder, ICollection<ExportableMetricCopy> exportedItems)
{
Guard.ThrowIfNull(builder);
Guard.ThrowIfNull(exportedItems);

if (builder is IDeferredMeterProviderBuilder deferredMeterProviderBuilder)
{
return deferredMeterProviderBuilder.Configure((sp, builder) =>
{
AddInMemoryExporter(builder, exportedItems, sp.GetOptions<MetricReaderOptions>(), null);
});
}

return AddInMemoryExporter(builder, exportedItems, new MetricReaderOptions(), null);
}

/// <summary>
/// Adds InMemory metric exporter to the <see cref="MeterProviderBuilder"/> using default options.
/// </summary>
/// <param name="builder"><see cref="MeterProviderBuilder"/> builder to use.</param>
/// <param name="exportedItems">Collection which will be populated with the exported MetricItem represented as <see cref="ExportableMetricCopy"/>.</param>
/// <param name="configureMetricReader"><see cref="MetricReader"/> configuration options.</param>
/// <returns>The instance of <see cref="MeterProviderBuilder"/> to chain the calls.</returns>
public static MeterProviderBuilder AddInMemoryExporter(
this MeterProviderBuilder builder,
ICollection<ExportableMetricCopy> exportedItems,
Action<MetricReaderOptions> configureMetricReader)
{
Guard.ThrowIfNull(builder);
Guard.ThrowIfNull(exportedItems);
Expand Down Expand Up @@ -93,5 +152,27 @@ private static MeterProviderBuilder AddInMemoryExporter(

return builder.AddReader(metricReader);
}

private static MeterProviderBuilder AddInMemoryExporter(
MeterProviderBuilder builder,
ICollection<ExportableMetricCopy> exportedItems,
MetricReaderOptions metricReaderOptions,
Action<MetricReaderOptions> configureMetricReader)
{
configureMetricReader?.Invoke(metricReaderOptions);

var metricExporter = new InMemoryExporter<Metric>(null)
{
AdditionalExportAction = metric => exportedItems.Add(new ExportableMetricCopy(metric)),
};

var metricReader = PeriodicExportingMetricReaderHelper.CreatePeriodicExportingMetricReader(
metricExporter,
metricReaderOptions,
DefaultExportIntervalMilliseconds,
DefaultExportTimeoutMilliseconds);

return builder.AddReader(metricReader);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\OpenTelemetry\Internal\PeriodicExportingMetricReaderHelper.cs" Link="Includes\PeriodicExportingMetricReaderHelper.cs" />
<Compile Include="$(RepoRoot)\src\OpenTelemetry\Internal\ServiceProviderExtensions.cs" Link="Includes\ServiceProviderExtensions.cs" />
<!--<Compile Include="$(RepoRoot)\src\OpenTelemetry\Internal\PeriodicExportingMetricReaderHelper.cs" Link="Includes\PeriodicExportingMetricReaderHelper.cs" />
<Compile Remove="C:\REPOS\opentelemetry-dotnet-fork\src\OpenTelemetry\Internal\ServiceProviderExtensions.cs" />
TimothyMothra marked this conversation as resolved.
Show resolved Hide resolved
<Compile Include="$(RepoRoot)\src\OpenTelemetry\Internal\ServiceProviderExtensions.cs" Link="Includes\ServiceProviderExtensions.cs" />-->
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Api\Internal\Guard.cs" Link="Includes\Guard.cs" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions src/OpenTelemetry/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.Prometheus.Tests" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Extensions.Hosting.Tests" + AssemblyInfo.PublicKey)]
[assembly: InternalsVisibleTo("OpenTelemetry.Exporter.InMemory" + AssemblyInfo.PublicKey)]
TimothyMothra marked this conversation as resolved.
Show resolved Hide resolved
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)]
[assembly: InternalsVisibleTo("Benchmarks" + AssemblyInfo.PublicKey)]
2 changes: 1 addition & 1 deletion test/Benchmarks/Metrics/HistogramBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void Setup()
this.bounds[i] = i * MaxValue / this.bounds.Length;
}

var exportedItems = new List<Metric>();
var exportedItems = new List<ExportableMetricCopy>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it required to force every test to use the new MetricCopy unless they need to rely on it?
Or is it by design that InMemoryExporter will force one to use the MetricCopy option only? What I don't need/care about the fact that Metric could be update after export() call is done?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, current approach was to force the use of the Copy.
See the comment above for more details #3198 (comment)


this.provider = Sdk.CreateMeterProviderBuilder()
.AddMeter(this.meter.Name)
Expand Down
2 changes: 1 addition & 1 deletion test/Benchmarks/Metrics/MetricsBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void Setup()
{
this.meter = new Meter(Utils.GetCurrentMethodName());

var exportedItems = new List<Metric>();
var exportedItems = new List<ExportableMetricCopy>();
this.provider = Sdk.CreateMeterProviderBuilder()
.AddMeter(this.meter.Name) // All instruments from this meter are enabled.
.AddInMemoryExporter(exportedItems, metricReaderOptions =>
Expand Down
4 changes: 2 additions & 2 deletions test/Benchmarks/Metrics/MetricsViewBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class MetricsViewBenchmarks
private static readonly ThreadLocal<Random> ThreadLocalRandom = new(() => new Random());
private static readonly string[] DimensionValues = new string[] { "DimVal1", "DimVal2", "DimVal3", "DimVal4", "DimVal5", "DimVal6", "DimVal7", "DimVal8", "DimVal9", "DimVal10" };
private static readonly int DimensionsValuesLength = DimensionValues.Length;
private List<Metric> metrics;
private List<ExportableMetricCopy> metrics;
private Counter<long> counter;
private MeterProvider provider;
private Meter meter;
Expand Down Expand Up @@ -81,7 +81,7 @@ public void Setup()
{
this.meter = new Meter(Utils.GetCurrentMethodName());
this.counter = this.meter.CreateCounter<long>("counter");
this.metrics = new List<Metric>();
this.metrics = new List<ExportableMetricCopy>();

if (this.ViewConfig == ViewConfiguration.NoView)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void HttpDurationMetricIsEmitted()
})
.Build();

var exportedItems = new List<Metric>();
var exportedItems = new List<ExportableMetricCopy>();
using var meterprovider = Sdk.CreateMeterProviderBuilder()
.AddAspNetInstrumentation()
.AddInMemoryExporter(exportedItems)
Expand All @@ -61,7 +61,7 @@ public void HttpDurationMetricIsEmitted()
meterprovider.ForceFlush();

var metricPoints = new List<MetricPoint>();
foreach (var p in exportedItems[0].GetMetricPoints())
foreach (var p in exportedItems[0].MetricPoints)
{
metricPoints.Add(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void AddAspNetCoreInstrumentation_BadArgs()
[Fact]
public async Task RequestMetricIsCaptured()
{
var metricItems = new List<Metric>();
var metricItems = new List<ExportableMetricCopy>();

this.meterProvider = Sdk.CreateMeterProviderBuilder()
.AddAspNetCoreInstrumentation()
Expand Down Expand Up @@ -85,7 +85,7 @@ public async Task RequestMetricIsCaptured()
Assert.NotNull(metric);
Assert.True(metric.MetricType == MetricType.Histogram);
var metricPoints = new List<MetricPoint>();
foreach (var p in metric.GetMetricPoints())
foreach (var p in metric.MetricPoints)
{
metricPoints.Add(p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOut
var processor = new Mock<BaseProcessor<Activity>>();
tc.Url = HttpTestData.NormalizeValues(tc.Url, host, port);

var metrics = new List<Metric>();
var metrics = new List<ExportableMetricCopy>();

var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddHttpClientInstrumentation()
Expand Down Expand Up @@ -146,7 +146,7 @@ public async Task HttpOutCallsAreCollectedSuccessfullyAsync(HttpTestData.HttpOut
Assert.True(metric.MetricType == MetricType.Histogram);

var metricPoints = new List<MetricPoint>();
foreach (var p in metric.GetMetricPoints())
foreach (var p in metric.MetricPoints)
{
metricPoints.Add(p);
}
Expand Down
Loading