grafana / grafana/otel-profiling-java

Profiling samples not correctly attributed to spans when using thread pools

Open
#44 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
53
Forks
10
Avg merge
4d 9h
Merged PRs (30d)
4

Description

## Description

When using thread pools or executors, profiling samples are not correctly associated with their spans. Samples may
be attributed to the wrong span or have no span association at all.

## Expected Behavior

Profiling samples should be correctly attributed to the span that was active when the sample was taken, regardless
of which thread the work executes on.

## Actual Behavior

- Samples taken on executor threads are not associated with the correct span
- When a child span ends, samples for the still-active parent span lose their span association

## Root Cause

1. OTel context propagates via Java ThreadLocals when work moves between threads
2. Async-profiler uses native pthread thread-local storage for span correlation
3. These two are not synchronized on thread context switches

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.