open-telemetry / open-telemetry/opentelemetry-java

Increase the log level for potential ThreadLocal leaks

Open
#6,986 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Is your feature request related to a problem? Please describe.
We've observed some ThreadLocal leaks due to the unclosed scope or close attempts in wrong order.
It makes really hard to figure out the cause when it works with opentelemetry java instrumentation because it's working as a shaded dependency and the log message level if FINE.
It's hard to implement a custom context storage when it comes with java instrumentation.

Describe the solution you'd like
I hope that it can be log the wrong attempts of closing the scope as ERROR or WARN level at least.

Describe alternatives you've considered
N?A

Additional context
N/A

Contributor guide

Open the contributing guide

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.

Research direction

Start with context/src/main/java/io/opentelemetry/context/ThreadLocalContextStorage.java at the referenced line and inspect how incorrect scope-closing attempts are currently logged. Check the existing context tests, then verify that these attempts are emitted at WARN or ERROR level and that the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.