File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
instrumentation/opentelemetry-instrumentation-flask/tests Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1616from werkzeug .test import Client
1717from werkzeug .wrappers import Response
1818
19+ from opentelemetry import trace as trace_api
1920from opentelemetry .instrumentation .flask import FlaskInstrumentor
2021from opentelemetry .test .wsgitestutil import WsgiTestBase
2122
@@ -78,3 +79,18 @@ def test_exluded_urls_explicit(self):
7879 self .assertEqual ([b"Hello: 456" ], list (resp .response ))
7980 span_list = self .memory_exporter .get_finished_spans ()
8081 self .assertEqual (len (span_list ), 1 )
82+
83+ def test_no_op_tracer_provider (self ):
84+ FlaskInstrumentor ().uninstrument ()
85+ FlaskInstrumentor ().instrument (
86+ tracer_provider = trace_api .NoOpTracerProvider ()
87+ )
88+
89+ self .app = flask .Flask (__name__ )
90+ self .app .route ("/hello/<int:helloid>" )(self ._hello_endpoint )
91+ # pylint: disable=attribute-defined-outside-init
92+ self .client = Client (self .app , Response )
93+ self .client .get ("/hello/123" )
94+
95+ span_list = self .memory_exporter .get_finished_spans ()
96+ self .assertEqual (len (span_list ), 0 )
You can’t perform that action at this time.
0 commit comments