open-telemetry / open-telemetry/opentelemetry-java-instrumentation
Measure pending time in Executors
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1.2k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 214
Description
Is your feature request related to a problem? Please describe.
What do you think about adding instrumentation to Executors which will measure, how long tasks are being stucked in a queue?
For example, right now in Spring applications, depending on configuration, it may happen that:
client metric tells 20s, while in reality it was 10s
server metric tells 5s, while in reality it was 10s
Reason for that it's very simple: Thread Pool Saturation.
From my experience I would say, that libraries, frameworks measure usually number of tasks, but... is 10 high? or maybe 1_000_000? That's why pending time seems in my opinion like something very useful
Here some reproducible example for Spring Application
https://github.com/spring-projects/spring-framework/issues/35302
Describe the solution you'd like
the whole idea is to have something like this
class MonitoredExecutor internal constructor(private val delegate: Executor) : Executor {
override fun execute(runnable: Runnable) {
delegate.execute(MonitoredRunnable(runnable))
}
}
class MonitoredRunnable internal constructor(private val delegate: Runnable) : Runnable {
private val startTime = System.nanoTime()
override fun run() {
val duration = Duration.ofNanos(System.nanoTime() - startTime)
SomeLogger.log(this, "WORKAROUND Http server pending request took: $duration")
delegate.run()
}
}
Describe alternatives you've considered
No response
Additional context
I'm opening this issue in Java repository, but I think it's applicable probably for any other programming language
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the repository's Executor instrumentation entry point and compare it with the Kotlin MonitoredExecutor example and the linked Spring reproduction. Before implementation, clarify which executors and metric semantics are in scope; done should include a defined pending-time measurement and verification for the supported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100