File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
instrumentation/opentelemetry-instrumentation-asgi/tests Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7474 ([ #1197 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1197 ) )
7575- Add metric instumentation for flask
7676 ([ #1186 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1186 ) )
77+ - Add a test for asgi using NoOpTracerProvider
78+ ([ #1367 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1367 ) )
7779
7880## [ 1.12.0rc2-0.32b0] ( https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc2-0.32b0 ) - 2022-07-01
7981
Original file line number Diff line number Diff line change @@ -300,6 +300,20 @@ def test_custom_tracer_provider_otel_asgi(self):
300300 span .resource .attributes ["service-test-key" ], "value"
301301 )
302302
303+ def test_no_op_tracer_provider_otel_asgi (self ):
304+ app = otel_asgi .OpenTelemetryMiddleware (
305+ simple_asgi , tracer_provider = trace_api .NoOpTracerProvider ()
306+ )
307+ self .seed_app (app )
308+ self .send_default_request ()
309+
310+ response_start , response_body , * _ = self .get_all_output ()
311+ self .assertEqual (response_body ["body" ], b"*" )
312+ self .assertEqual (response_start ["status" ], 200 )
313+
314+ span_list = self .memory_exporter .get_finished_spans ()
315+ self .assertEqual (len (span_list ), 0 )
316+
303317 def test_behavior_with_scope_server_as_none (self ):
304318 """Test that middleware is ok when server is none in scope."""
305319
You can’t perform that action at this time.
0 commit comments