Skip to content

Commit

Permalink
Benchmarks for metrics modified to have a metric reader (#4974)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Oct 24, 2023
1 parent faa70be commit 637ddcf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,14 @@ public void GetRequestForAspNetCoreAppGlobalSetup()
this.StartWebApplication();
this.httpClient = new HttpClient();

var exportedItems = new List<Metric>();
this.meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureServices(services => services.AddSingleton<IConfiguration>(configuration))
.AddAspNetCoreInstrumentation()
.AddInMemoryExporter(exportedItems, metricReaderOptions =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000;
})
.Build();
}
else if (this.EnableInstrumentation.HasFlag(EnableInstrumentationOption.Traces) &&
Expand All @@ -155,9 +160,14 @@ public void GetRequestForAspNetCoreAppGlobalSetup()
.AddAspNetCoreInstrumentation()
.Build();

var exportedItems = new List<Metric>();
this.meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureServices(services => services.AddSingleton<IConfiguration>(configuration))
.AddAspNetCoreInstrumentation()
.AddInMemoryExporter(exportedItems, metricReaderOptions =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000;
})
.Build();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ public void HttpClientRequestGlobalSetup()
this.StartWebApplication();
this.httpClient = new HttpClient();

var exportedItems = new List<Metric>();
this.meterProvider = Sdk.CreateMeterProviderBuilder()
.AddHttpClientInstrumentation()
.AddInMemoryExporter(exportedItems, metricReaderOptions =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000;
})
.Build();
}
else if (this.EnableInstrumentation.HasFlag(EnableInstrumentationOption.Traces) &&
Expand All @@ -106,8 +111,13 @@ public void HttpClientRequestGlobalSetup()
.AddHttpClientInstrumentation()
.Build();

var exportedItems = new List<Metric>();
this.meterProvider = Sdk.CreateMeterProviderBuilder()
.AddHttpClientInstrumentation()
.AddInMemoryExporter(exportedItems, metricReaderOptions =>
{
metricReaderOptions.PeriodicExportingMetricReaderOptions.ExportIntervalMilliseconds = 1000;
})
.Build();
}
}
Expand Down

0 comments on commit 637ddcf

Please sign in to comment.