Skip to content

Add wf_reported_problems_set and wf_reported_problems_cleared Metrics - #11346

Draft
ytaben wants to merge 1 commit into
temporalio:mainfrom
ytaben:ytaben/workflow-problems-metric
Draft

Add wf_reported_problems_set and wf_reported_problems_cleared Metrics#11346
ytaben wants to merge 1 commit into
temporalio:mainfrom
ytaben:ytaben/workflow-problems-metric

Conversation

@ytaben

@ytaben ytaben commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What changed?

This PR adds wf_reported_problems_set and wf_reported_problems_cleared metrics.

These are counter metrics that are incremented exactly when the corresponding search attribute is set or cleared (TemporalReportedProblems)

Why?

We are looking for a way to help our users with reliably identifying and alerting on situations when workflows in their namespaces are not making progress for any reason.

At present - there are several ways to do this but none appear to be quite as reliable.

For example - client side workflow task failures do not trigger on server side issues. We had a case where users tried cross-namespace signalling. Workflow task 'succeeds' on the SDK side but only the server side sees WFT failure and increments a metric. Afaik something like payload size can also be a reason for server side rejection though maybe SDKs check it themselves now. This should also help with s2s timeouts where workflows are stuck because workers are dead.

Conversely - a single transient workflow task failure that is immediately retried afterwards should not be a reason to page someone. In other words - either client or server side WFT failure metrics don't show if the workflow is persistently stuck.

Notes

We added counters for both addition and removal of the search attribute for completeness but are ok with only having addition.

We are also ok with not having WF type tag though it looks to be canonically present throughout the repo.

We are also ok to close this if there was already a better way to do this that we did not think of.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Pending test: deploy a cherry-pick on top of our current Temporal version in a fork
UPD:
Deployed this commit to our sandbox cluster and forced WFT failure (workflow type not registered)
Found wf_reported_problems_set metric reported with correct 'namespace', 'workflowtype' tags and 'cause:workflowtaskfailedcauseunspecified'

(we use datadog so it may be mangling casing)

Potential risks

This technically adds metric costs

Add wf_reported_problems_set and wf_reported_problems_cleared counters,
emitted when the TemporalReportedProblems search attribute is set/updated
after consecutive workflow task problems and when it is cleared on the next
successful workflow task. This makes server-side "stuck workflow" detection
observable/alertable without polling the visibility store per namespace.

Counters are emitted at the SA state transitions (after the existing
early-returns) so unchanged/no-op paths do not over-count, and only on the
live paths (not history replay). Tags: namespace, cause (set only), and
workflow_type (unconditional, matching existing workflow-lifecycle metrics
such as WorkflowSuccessCount and PausedActivitiesCounter).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant