fix: don't double export aggregate efficiency metrics #3230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was discovered by log messages from Prometheus like this:
msg="Error on ingesting samples with different value but same timestamp"
after enabling debug logging in Prometheus more information is printed
Oct 24 04:24:07 harvest-ubuntu-03 prometheus[32020]: ts=2024-10-24T08:24:07.702Z caller=scrape.go:1859 level=debug component="scrape manager" scrape_pool=prometheus target=
http://localhost:13002/metrics
msg="Duplicate sample for timestamp" series="aggr_total_physical_used{aggr="umeng_aff300_aggr2",cluster="umeng-aff300-01-02",datacenter="nane",node="umeng-aff300-01"}"
This happened when you specified collectors in this order:
The Zapi collector exports aggregate efficiency objects via the AggregateEfficiency template while the REST collector exports them via the Aggregate template. That means the normal object/collector dedup logic won't handle these metrics and they are double exported.
This fix removes the double export and Prometheus ingest error.