From 4108d57e7ae6bb38d1ac638a6392f3a53dac2853 Mon Sep 17 00:00:00 2001 From: B Ramshankar Date: Fri, 16 Aug 2024 22:27:24 +0100 Subject: [PATCH] fix for Audit and test opentelemetry-instrumentation-jinja2 #978 (#2799) --- .../tests/test_jinja2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/tests/test_jinja2.py b/instrumentation/opentelemetry-instrumentation-jinja2/tests/test_jinja2.py index 542a65d220..26ba98e69b 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/tests/test_jinja2.py +++ b/instrumentation/opentelemetry-instrumentation-jinja2/tests/test_jinja2.py @@ -219,3 +219,14 @@ def test_uninstrumented(self): self.assertEqual(len(spans), 0) Jinja2Instrumentor().instrument() + + def test_no_op_tracer_provider(self): + self.memory_exporter.clear() + Jinja2Instrumentor().uninstrument() + Jinja2Instrumentor().instrument( + tracer_provider=trace_api.NoOpTracerProvider() + ) + template = jinja2.environment.Template("Hello {{name}}!") + self.assertEqual(template.render(name="Jinja"), "Hello Jinja!") + spans = self.memory_exporter.get_finished_spans() + self.assertEqual(len(spans), 0)