temporalio / temporalio/sdk-java
Metric scope for workflow instance should ignore metrics written after a destruction of the instance is requested
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Expected Behavior
Users should be able to use Workflow's MetricScope obtained from Workflow.getMetricsScope() in a workflow's finally blocks without accounting for DestroyWorkflowThreadError that may happen unexpectedly and uncontrollably.
Actual Behavior
DestroyWorkflowThreadError triggers finally blocks and lead to double-reporting of metrics on workflow instance eviction.
Solution
Temporal SDK should make workflow's MetricsScope aware of the fact that the instance destruction is requested and not allow any new metric's reporting in this case.
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 locating Workflow.getMetricsScope(), MetricScope reporting, and handling for DestroyWorkflowThreadError. Trace how destruction requests reach workflow finally blocks. Done means metrics written after destruction is requested are ignored, preventing double-reporting during workflow instance eviction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100