Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit and test opentelemetry-instrumentation-wsgi NoOpTracerProvider #1610

Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,16 @@ def test_basic_wsgi_call(self):
response = app(self.environ, self.start_response)
self.validate_response(response, exporter)

def test_no_op_tracer_provider(self):
app = otel_wsgi.OpenTelemetryMiddleware(
simple_wsgi, tracer_provider=trace_api.NoOpTracerProvider
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use trace_api.NoOpTracerProvider()
You should move to the instrument function initialized tracer_provider and not the Class object

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

)

response = app(self.environ, self.start_response)
next(response)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next(response) will throw a StopIteration exception if the iterator is empty

span_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(span_list), 0)


class TestWsgiMiddlewareWrappedWithAnotherFramework(WsgiTestBase):
def test_mark_span_internal_in_presence_of_span_from_other_framework(self):
Expand Down