Skip to content

Fix unhashable dict tag crashing triggerer metrics (#66353)#66354

Closed
jakubmatyszewski wants to merge 1 commit into
apache:mainfrom
jakubmatyszewski:fix_triggerer_otel_typerror
Closed

Fix unhashable dict tag crashing triggerer metrics (#66353)#66354
jakubmatyszewski wants to merge 1 commit into
apache:mainfrom
jakubmatyszewski:fix_triggerer_otel_typerror

Conversation

@jakubmatyszewski

@jakubmatyszewski jakubmatyszewski commented May 4, 2026

Copy link
Copy Markdown

The triggerer crashes with a TypeError: unhashable type: 'dict' when OpenTelemetry metrics are enabled.

Root cause

The crash occurs because Callback.get_metric_info() in airflow/models/callback.py can return a tags dict containing a nested dict as a value (the "kwargs" key). OpenTelemetry's _view_instrument_match.py later calls frozenset(attributes.items()) to build an aggregation key, which fails because dict values are not hashable.

Fix

Serialize the remaining kwargs to a string, or drop them if empty.

How to reproduce

  1. Start Airflow with OTeL enabled (the OTel endpoint doesn't need to be reachable - the crash happens before any export).
  2. Spawn task that will trigger DeadlineAlert.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

`get_metric_info` left a `dict` value under the `kwargs` tag, causing
`TypeError: unhashable type: 'dict'` in OpenTelemetry's
`_view_instrument_match` when building the attribute frozenset.
Serialize non-empty filtered kwargs to `str` and drop the key when empty.
@jakubmatyszewski jakubmatyszewski force-pushed the fix_triggerer_otel_typerror branch from 854da6c to 11e66a5 Compare May 5, 2026 19:58
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 11, 2026
@manipatnam

Copy link
Copy Markdown
Contributor

This is already fixed in #67527
We can close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Triggerer keeps crashing after DeadlineAlert is triggered with OTeL enabled

3 participants