File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
instrumentation/opentelemetry-instrumentation-django/tests Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2323from django .test import SimpleTestCase
2424from django .test .utils import setup_test_environment , teardown_test_environment
2525
26+ from opentelemetry import trace as trace_api
2627from opentelemetry .instrumentation .django import (
2728 DjangoInstrumentor ,
2829 _DjangoMiddleware ,
@@ -424,6 +425,16 @@ async def test_tracer_provider_traced(self):
424425 span .resource .attributes ["resource-key" ], "resource-value"
425426 )
426427
428+ async def test_no_op_tracer_provider (self ):
429+ _django_instrumentor .uninstrument ()
430+ _django_instrumentor .instrument (
431+ tracer_provider = trace_api .NoOpTracerProvider ()
432+ )
433+
434+ await self .async_client .post ("/traced/" )
435+ spans = self .exporter .get_finished_spans ()
436+ self .assertEqual (len (spans ), 0 )
437+
427438
428439@patch .dict (
429440 "os.environ" ,
You can’t perform that action at this time.
0 commit comments