Skip to content

Commit

Permalink
Stress test modified to have a reader to force sdk to do aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas committed Nov 20, 2021
1 parent 3a516f3 commit a97644b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests.Stress\Skeleton.cs" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.InMemory\OpenTelemetry.Exporter.InMemory.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions test/OpenTelemetry.Tests.Stress.Metrics/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
// </copyright>

using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Runtime.CompilerServices;
using System.Threading;
using OpenTelemetry;
using OpenTelemetry.Exporter;
using OpenTelemetry.Metrics;
using OpenTelemetry.Tests;

namespace OpenTelemetry.Tests.Stress;

public partial class Program
{
private const int ArraySize = 10;
Expand All @@ -39,8 +38,12 @@ public static void Main()
DimensionValues[i] = $"DimValue{i}";
}

var exportedItems = new List<Metric>();
var reader = new BaseExportingMetricReader(new InMemoryExporter<Metric>(exportedItems));

using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter(TestMeter.Name)
.AddReader(reader)
.Build();
Stress();
}
Expand Down

0 comments on commit a97644b

Please sign in to comment.