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 16
16
from werkzeug .test import Client
17
17
from werkzeug .wrappers import Response
18
18
19
+ from opentelemetry import trace as trace_api
19
20
from opentelemetry .instrumentation .flask import FlaskInstrumentor
20
21
from opentelemetry .test .wsgitestutil import WsgiTestBase
21
22
@@ -78,3 +79,18 @@ def test_exluded_urls_explicit(self):
78
79
self .assertEqual ([b"Hello: 456" ], list (resp .response ))
79
80
span_list = self .memory_exporter .get_finished_spans ()
80
81
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