Skip to content

[Feature] Apply tags config to metrics #12607

@dtaniwaki

Description

@dtaniwaki

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Tags specified for metrics are not reflected in parsed metric nodes in the following cases:

Case 1: +tags in dbt_project.yml

# dbt_project.yml
metrics:
  my_project:
    +tags:
      - project_tag

Case 2: tags in the metric's config: block (YAML)

# models/schema.yml
metrics:
  - name: my_metric
    label: "My Metric"
    type: simple
    type_params:
      measure: my_measure
    config:
      tags:
        - yaml_tag

After dbt parse, neither project_tag nor yaml_tag appears in the metric's tags field in manifest.json.

This affects both v1 and v2 metrics:

  • v1 (UnparsedMetric): only inline tags: at the metric top level are used; config.tags (from YAML or dbt_project.yml) are ignored.
  • v2 (UnparsedMetricV2): tags are always initialized to []; all tag sources are ignored.

Expected Behavior

Tags should be applied to metrics from all sources, consistent with models and other nodes:

  • config.tags in the YAML definition
  • +tags in dbt_project.yml
  • These should be merged with any inline tags: specified on the metric.

Steps To Reproduce

  1. Create a project with a metric.
  2. Add config: tags: [yaml_tag] to the metric in schema.yml, or add +tags: [project_tag] to dbt_project.yml under metrics:.
  3. Run dbt parse.
  4. Check target/manifest.json — the metric's tags field is empty.

Relevant log output

N/A

Environment

- OS:
- Python:
- dbt:

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

dbt-athena

Root cause is in core/dbt/parser/schema_yaml_readers.py (MetricParser): the resolved config dict (containing merged tags from all sources) is computed but its tags value is never merged into the metric's tag list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsemanticIssues related to the semantic layer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions