Skip to content

Extra metrics are being sent to DataDog when using Allow list with pattern matching enabled #39400

Closed as not planned

Description

@rawwar

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

No response

What happened?

with AIRFLOW__METRICS__METRICS_USE_PATTERN_MATCH set to true and AIRFLOW__METRICS__METRICS_ALLOW_LIST set to .*get_astronauts.* , I notice several other metrics being sent to datadog that don't match the pattern:
image

What you think should happen instead?

Following metrics shouldn't be showing up on datadog when the allow list is .*get_astronauts.*:

  1. airflow.dag.task.duration.*
  2. airflow.ti.*
  3. datadog.* (Not sure if we have any control to block these)

How to reproduce

env variables:

AIRFLOW__METRICS__STATSD_DATADOG_ENABLED true
AIRFLOW__METRICS__STATSD_DATADOG_TAGS testNo:C2
DATADOG_API_KEY ● ● ● ● ● ● ●
AIRFLOW__METRICS__METRICS_USE_PATTERN_MATCH true
AIRFLOW__METRICS__METRICS_ALLOW_LIST .*print_astronaut_craft.*

Once you update your datadog key here, you will start seeing metrics in datadog-->metrics-->summary . use the tag testNo:C2 to filter

Operating System

Debian GNU/Linux 11 (bullseye)

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. self-assigned this
    on May 5, 2024
  2. added and removed
    needs-triagelabel for new issues that we didn't triage yet
    on May 7, 2024
  3. eladkal commented on Mar 3, 2025

    @eladkal
    Contributor

    @rawwar is this still an issue on main?

  4. rawwar commented on Mar 6, 2025

    @rawwar
    ContributorAuthor

    I'll try to replicate it later this week and reconfirm.

  5. rawwar commented on Mar 8, 2025

    @rawwar
    ContributorAuthor

    @eladkal , Yes. i just tested this and I can still replicate it. I added a allow list and yet, I see airflow.dag.task.duration.*, airflow.ti.* and others. in the screenshot, the results are when I added a tag "name:aftest" and allow list to be .*fail_zombie.*

    Image

  6. removed their assignment
    on Mar 8, 2025
  7. rawwar commented on Mar 8, 2025

    @rawwar
    ContributorAuthor

    However, I've unassigned myself as I won't be able to work on it at this time.

  8. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.

  9. eladkal commented on Sep 14, 2026

    @eladkal
    Contributor

    cc @hussein-awala maybe someone from datadog has the time to pick it up?

  10. hussein-awala commented on Sep 15, 2026

    @hussein-awala
    Member

    I had a look at this on main and I don't think it's still valid.

    metrics_use_pattern_match was removed in Airflow 3 — pattern matching is the only
    mode now, so the config in the repro doesn't exist anymore. And the allow list itself
    is applied on every emit path in the Datadog logger (incr, decr, gauge, timing, timer),
    including for legacy metric names, so nothing is slipping past the filter.

    What was really happening is that ti.start, ti.finish and task.duration don't have
    the dag_id in the metric name — it's in the tags. So a pattern like
    .*get_astronauts.* was never going to match them. It only matches the legacy names
    (dag.{dag_id}.{task_id}.duration and friends), which are behind legacy_names_on. The
    datadog.* ones are the DogStatsd client's own telemetry and were always outside our
    allow list.

    So this isn't a filtering bug — it's that allow/block lists match on names and aren't
    tag-aware. That's a reasonable thing to want, but it's a different change from what's
    described here, so I'd rather see it as its own feature request. Closing this one.


    Drafted-by: Claude Code (Opus 5); reviewed by @hussein-awala before posting

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions