Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

jinja2: tracing ignores suppress_instrumentation()

Open Beginner friendly
#5,167 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@RichardoMrMu is already working on this.

Since Oct 12, 2026.

  • #5174 by @RichardoMrMu — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
observability

Research direction

Start with the Jinja2 instrumentation package and the shared tracing wrapper it uses, and check how suppress_instrumentation() from opentelemetry.instrumentation.utils is consulted there. Run the reproduction script in the issue, which should print [] under suppression. Done means no spans are created inside the suppressed block, spans resume afterward, and template loading and generate() are covered by tests. The reporter says they plan to open the PR, so confirm with them before starting.

Written by the indexing model from the issue text.

Description

Describe your environment

Python 3.10/3.12/3.14, Jinja2 3.1.6; current main (77dd2d009dec5bfa04fcecb8e2e3d1bb33ff218b).

What happened?

Jinja2 instrumentation emits compilation, loading and rendering spans inside suppress_instrumentation(), even though callers explicitly suppress instrumentation for that operation.

Steps to Reproduce
import jinja2
from opentelemetry.instrumentation.jinja2 import Jinja2Instrumentor
from opentelemetry.instrumentation.utils import suppress_instrumentation
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter

exporter = InMemorySpanExporter()
provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(exporter))
Jinja2Instrumentor().instrument(tracer_provider=provider)

with suppress_instrumentation():
    template = jinja2.Template("Hello {{ name }}!")
    assert template.render(name="Jinja") == "Hello Jinja!"

print([span.name for span in exporter.get_finished_spans()])
Expected Result

No instrumentation spans: [].

Actual Result

['jinja2.compile', 'jinja2.render']. Template loading and generate() also ignore suppression.

Additional context

A fix checking the suppression flag in the shared tracing wrapper is locally verified. Tests cover inherited templates, rendered/generated output, exception behavior, and tracing resuming after suppression. I will submit the corresponding PR.

Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
3d 22h
Merged PRs (30d)
31

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-telemetry/opentelemetry-python-contrib

All issues in open-telemetry/opentelemetry-python-contrib

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.