Skip to content

[exporterhelper] Fix metric name preservation during request splitting #13238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

lsj4401
Copy link

@lsj4401 lsj4401 commented Jun 19, 2025

Description

This PR fixes an issue in exporter/exporterhelper's sending_queue where metric names were lost during metricRequest splitting. Previously, when large batches of metrics were processed, the splitting logic in metric_batch.go could cause the name field of some metrics to disappear. This fix ensures that all metric fields are properly preserved when metricRequest objects are split.

Link to tracking issue

Fixes #13236

Resolve an issue in  where metric names were lost when splitting  objects. Updated logic now ensures all metric fields, including names, are retained across splitting operations. Added relevant tests to validate the fix.
@lsj4401 lsj4401 requested review from bogdandrutu, dmitryax and a team as code owners June 19, 2025 15:28
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

If there is a bug please add a test to reproduce it

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

See comment about new added bug. Please add tests

Ensure metric metadata is copied when splitting data points by adding a `CopyTo` call. Added comprehensive test coverage to verify correct behavior for various metric types and scenarios.
@github-actions github-actions bot requested a review from bogdandrutu June 20, 2025 22:29
lsj4401 added 2 commits June 21, 2025 07:50
Previously, RequestSizerTypeBytes was calculating datapoint size incorrectly due to the omission of 'name', 'description', and 'unit' fields. This commit rectifies the calculation by including these fields.
@lsj4401
Copy link
Author

lsj4401 commented Jun 22, 2025

See comment about new added bug. Please add tests

@bogdandrutu
Added tests to confirm the bug and fixed an issue where bytes were being calculated with missing name, description, and unit fields in existing tests.

lsj4401 added 3 commits June 24, 2025 06:25
This update ensures that metadata is copied from source to destination metrics during transformation. Tests have been updated to validate metadata handling, including verifying key-value pairs in the metadata.
@lsj4401
Copy link
Author

lsj4401 commented Jun 24, 2025

@bogdandrutu
Would you mind reviewing this again?

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.63%. Comparing base (18b3b57) to head (e95dce4).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13238      +/-   ##
==========================================
- Coverage   91.64%   91.63%   -0.02%     
==========================================
  Files         522      522              
  Lines       29183    29191       +8     
==========================================
+ Hits        26746    26750       +4     
- Misses       1920     1923       +3     
- Partials      517      518       +1     

☔ 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.

@lsj4401
Copy link
Author

lsj4401 commented Jun 29, 2025

@bogdandrutu
Could you please review this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metric names disappear when metricRequest is split in metric_batch.go with sending_queue
4 participants