Skip to content

[cmd/mdatagen] Test bug for disabled by default resource attributes with warnings #15007

@crobert-1

Description

@crobert-1

Component(s)

cmd/mdatagen

Describe the issue you're reporting

When a resource attribute is disabled by default and has a warning if it's enabled, mdatagen assumes there will be no warning in the TestMetricsBuilder test of generated_metrics_test.go, regardless of whether the test overrides the default value.

I believe the bug is here:

{{- if and $attr.Enabled $attr.Warnings.IfEnabled }}

We should not be checking the default value, as that is handled by the following check:

if tt.resAttrsSet == testDataSetDefault || tt.resAttrsSet == testDataSetAll {

I believe this is the case because the resource attribute will be enabled whether it's the default value OR all are enabled.

For context, this was hit in open-telemetry/opentelemetry-collector-contrib#47184

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

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