Skip to content

Conversation

@jinja2
Copy link
Contributor

@jinja2 jinja2 commented Jan 17, 2026

Description

Fixes reaggregation test generation when metrics have attributes with requirement_level: required.

  1. Config validation failure: The generated testdata/config.yaml included attributes: [] in the reaggregate_set section, but required attributes must always be present. This caused config validation to fail with an error like:
error decoding 'metrics': attributes [required_string_attr] are required for metric reaggregate.metric.with_required

Fix: Updated config.yaml.tmpl to use requiredAttributes helper to include required attributes in the reaggregate_set config instead of an empty array.

  1. Test assertion failure: The generated metrics_test.go used different values for required attributes across data points, preventing them from merging during reaggregation. The test expected 1 data point but received 2.

Fix - Updated metrics_test.go.tmpl to use the same value for required attributes across both data points in reaggregation tests, allowing them to merge correctly while still testing that non-required attributes are dropped.

Link to tracking issue

Fixes #

Testing

  • Added required_string_attr attribute and reaggregate.metric.with_required metric to samplereceiver/metadata.yaml to cover this scenario

Copy link
Member

@dmitryax dmitryax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks Jina!

@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 90.12346% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.80%. Comparing base (ba17669) to head (a8fbbe4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...plereceiver/internal/metadata/generated_metrics.go 89.18% 8 Missing ⚠️

❌ Your patch status has failed because the patch coverage (90.12%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14441      +/-   ##
==========================================
- Coverage   91.82%   91.80%   -0.03%     
==========================================
  Files         677      677              
  Lines       42610    42677      +67     
==========================================
+ Hits        39128    39179      +51     
- Misses       2423     2436      +13     
- Partials     1059     1062       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jinja2 jinja2 marked this pull request as ready for review January 17, 2026 01:03
@jinja2 jinja2 requested a review from a team as a code owner January 17, 2026 01:03
@jinja2 jinja2 requested a review from mx-psi January 17, 2026 01:03
@dmitryax
Copy link
Member

Actually no need for the changelog given that the feature isn't released yet

@dmitryax dmitryax added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 17, 2026
@jinja2 jinja2 force-pushed the reagg-mdatagen-tests branch from 092c0b3 to a8fbbe4 Compare January 17, 2026 01:44
@dmitryax dmitryax added this pull request to the merge queue Jan 17, 2026
Merged via the queue into open-telemetry:main with commit 7c31dd5 Jan 17, 2026
62 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmd/mdatagen Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants