Skip to content

remote: Add metadata validation to TestSampleDelivery for v2 protocol#16721

Merged
bwplotka merged 5 commits intoprometheus:mainfrom
AxcelXander:fix-issue-14414-metadata-test
Jul 29, 2025
Merged

remote: Add metadata validation to TestSampleDelivery for v2 protocol#16721
bwplotka merged 5 commits intoprometheus:mainfrom
AxcelXander:fix-issue-14414-metadata-test

Conversation

@AxcelXander
Copy link
Contributor

Update TestSampleDelivery test to check for metadata in remote write 2.0 protocol as requested in issue #14414.

Changes:

  • Fix v2RequestToWriteRequest to properly convert v2 metadata to v1 format
  • Add expectMetadata and expectMetadataForBatch methods to TestWriteClient
  • Update TestSampleDelivery to validate metadata for v2 protocol test cases
  • Ensure metadata is only expected for series that have data in each batch

This addresses the TODO comment about testing metadata in the 2.0 protocol and ensures that all data types (samples, exemplars, histograms, and metadata) are properly validated in the TestSampleDelivery test.

Fixes #14414

Update TestSampleDelivery test to check for metadata in remote write 2.0
protocol as requested in issue prometheus#14414.

Changes:
- Fix v2RequestToWriteRequest to properly convert v2 metadata to v1 format
- Add expectMetadata and expectMetadataForBatch methods to TestWriteClient
- Update TestSampleDelivery to validate metadata for v2 protocol test cases
- Ensure metadata is only expected for series that have data in each batch

This addresses the TODO comment about testing metadata in the 2.0 protocol
and ensures that all data types (samples, exemplars, histograms, and metadata)
are properly validated in the TestSampleDelivery test.

Fixes prometheus#14414

Signed-off-by: TYZ <ashaolinking@gmail.com>
Signed-off-by: TYZ <tyz666@bu.edu>
- Remove unnecessary type conversion in expectMetadataForBatch
- Remove unused expectMetadata function as only expectMetadataForBatch is used

Fixes golangci-lint warnings:
- unconvert: unnecessary conversion
- unused: func expectMetadata is unused

Signed-off-by: TYZ <tyz666@bu.edu>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks, great work!

@bwplotka
Copy link
Member

Some small nits only.

Final implementation of metadata validation in TestSampleDelivery for v2 protocol,
including proper error handling and assertion logic.

Signed-off-by: TYZ <tyz666@bu.edu>
AxcelXander and others added 2 commits June 18, 2025 23:04
Co-authored-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: AxcelXander <72107018+AxcelXander@users.noreply.github.com>
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks!

@bwplotka bwplotka merged commit a856188 into prometheus:main Jul 29, 2025
27 checks passed
tcp13equals2 pushed a commit to tcp13equals2/prometheus that referenced this pull request Aug 18, 2025
…metadata-test

remote: Add metadata validation to TestSampleDelivery for v2 protocol
Signed-off-by: Andrew Hall <andrew.hall@grafana.com>
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.

remote write 2.0 - update TestSampleDelivery to check for metadata in 2.0 proto

3 participants