File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
test/OpenTelemetry.Exporter.Prometheus.Tests Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,42 @@ public Task PrometheusExporterMiddlewareIntegration_NoMetrics()
167167 skipMetrics : true ) ;
168168 }
169169
170+ [ Fact ]
171+ public Task PrometheusExporterMiddlewareIntegration_MapEndpoint ( )
172+ {
173+ return RunPrometheusExporterMiddlewareIntegrationTest (
174+ "/metrics" ,
175+ app => app . UseRouting ( ) . UseEndpoints ( builder => builder . MapPrometheusScrapingEndpoint ( ) ) ,
176+ services => services . AddRouting ( ) ) ;
177+ }
178+
179+ [ Fact ]
180+ public Task PrometheusExporterMiddlewareIntegration_MapEndpoint_WithPathOverride ( )
181+ {
182+ return RunPrometheusExporterMiddlewareIntegrationTest (
183+ "/metrics_path" ,
184+ app => app . UseRouting ( ) . UseEndpoints ( builder => builder . MapPrometheusScrapingEndpoint ( "metrics_path" ) ) ,
185+ services => services . AddRouting ( ) ) ;
186+ }
187+
188+ [ Fact ]
189+ public async Task PrometheusExporterMiddlewareIntegration_MapEndpoint_WithMeterProvider ( )
190+ {
191+ using MeterProvider meterProvider = Sdk . CreateMeterProviderBuilder ( )
192+ . AddMeter ( MeterName )
193+ . AddPrometheusExporter ( )
194+ . Build ( ) ;
195+
196+ await RunPrometheusExporterMiddlewareIntegrationTest (
197+ "/metrics" ,
198+ app => app . UseRouting ( ) . UseEndpoints ( builder => builder . MapPrometheusScrapingEndpoint (
199+ path : null ,
200+ meterProvider : meterProvider ,
201+ configureBranchedPipeline : null ) ) ,
202+ services => services . AddRouting ( ) ,
203+ registerMeterProvider : false ) . ConfigureAwait ( false ) ;
204+ }
205+
170206 private static async Task RunPrometheusExporterMiddlewareIntegrationTest (
171207 string path ,
172208 Action < IApplicationBuilder > configure ,
You can’t perform that action at this time.
0 commit comments