Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek committed Sep 30, 2022
1 parent 5c5ae84 commit f0f85e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static MeterProviderBuilder AddPrometheusHttpListener(
MeterProviderBuilder builder,
PrometheusHttpListenerOptions options)
{
var exporter = new PrometheusExporter();
var exporter = new PrometheusExporter(new PrometheusExporterOptions { ScrapeResponseCacheDurationMilliseconds = 0 });

var reader = new BaseExportingMetricReader(exporter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public void TestAddPrometheusExporter_NamedOptions()
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.ConfigureServices(services =>
{
services.Configure<PrometheusExporterOptions>(o => defaultExporterOptionsConfigureOptionsInvocations++);
services.Configure<PrometheusAspNetCoreOptions>(o => defaultExporterOptionsConfigureOptionsInvocations++);

services.Configure<PrometheusExporterOptions>("Exporter2", o => namedExporterOptionsConfigureOptionsInvocations++);
services.Configure<PrometheusAspNetCoreOptions>("Exporter2", o => namedExporterOptionsConfigureOptionsInvocations++);
})
.AddPrometheusExporter()
.AddPrometheusExporter("Exporter2", o => { })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Task PrometheusExporterMiddlewareIntegration_Options()
return RunPrometheusExporterMiddlewareIntegrationTest(
"/metrics_options",
app => app.UseOpenTelemetryPrometheusScrapingEndpoint(),
services => services.Configure<PrometheusExporterOptions>(o => o.ScrapeEndpointPath = "metrics_options"));
services => services.Configure<PrometheusAspNetCoreOptions>(o => o.ScrapeEndpointPath = "metrics_options"));
}

[Fact]
Expand All @@ -61,7 +61,7 @@ public Task PrometheusExporterMiddlewareIntegration_OptionsFallback()
return RunPrometheusExporterMiddlewareIntegrationTest(
"/metrics",
app => app.UseOpenTelemetryPrometheusScrapingEndpoint(),
services => services.Configure<PrometheusExporterOptions>(o => o.ScrapeEndpointPath = null));
services => services.Configure<PrometheusAspNetCoreOptions>(o => o.ScrapeEndpointPath = null));
}

[Fact]
Expand Down Expand Up @@ -103,7 +103,7 @@ public Task PrometheusExporterMiddlewareIntegration_MixedPredicateAndPath()
context.Response.Headers.Add("X-MiddlewareExecuted", "true");
return next();
})),
services => services.Configure<PrometheusExporterOptions>(o => o.ScrapeEndpointPath = "/metrics_options"),
services => services.Configure<PrometheusAspNetCoreOptions>(o => o.ScrapeEndpointPath = "/metrics_options"),
validateResponse: rsp =>
{
if (!rsp.Headers.TryGetValues("X-MiddlewareExecuted", out IEnumerable<string> headers))
Expand All @@ -129,7 +129,7 @@ public Task PrometheusExporterMiddlewareIntegration_MixedPath()
context.Response.Headers.Add("X-MiddlewareExecuted", "true");
return next();
})),
services => services.Configure<PrometheusExporterOptions>(o => o.ScrapeEndpointPath = "/metrics_options"),
services => services.Configure<PrometheusAspNetCoreOptions>(o => o.ScrapeEndpointPath = "/metrics_options"),
validateResponse: rsp =>
{
if (!rsp.Headers.TryGetValues("X-MiddlewareExecuted", out IEnumerable<string> headers))
Expand Down Expand Up @@ -210,7 +210,7 @@ private static async Task RunPrometheusExporterMiddlewareIntegrationTest(
Action<IServiceCollection> configureServices = null,
Action<HttpResponseMessage> validateResponse = null,
bool registerMeterProvider = true,
Action<PrometheusExporterOptions> configureOptions = null,
Action<PrometheusAspNetCoreOptions> configureOptions = null,
bool skipMetrics = false)
{
using var host = await new HostBuilder()
Expand Down

0 comments on commit f0f85e1

Please sign in to comment.