Skip to content

Conversation

@VihasMakwana
Copy link
Contributor

Description

We should ideally empty a metric only if it has some datapoints in it. Right now, we can emit empty metric if the target_info arrives first and normal metrics arrives in subsequent request.

This PR adds a simple check to skip ConsumeMetrics if metric count is 0.

Testing

Updated tests

Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

I wouldn't say it's "Chore" though. We're changing behavior here. Could you add a changlog entry?

@songy23 songy23 changed the title [chore][receiver/prometheusremotewrite] skip emitting empty metrics [receiver/prometheusremotewrite] skip emitting empty metrics Nov 12, 2025
@songy23 songy23 added Skip Changelog PRs that do not require a CHANGELOG.md entry and removed Skip Changelog PRs that do not require a CHANGELOG.md entry labels Nov 12, 2025
@VihasMakwana
Copy link
Contributor Author

@ArthurSens I've added a change log.

@ArthurSens
Copy link
Member

Hmmm, weird. The diff with make generate doesn't seem related to this PR. I'm adding the ready to merge label but you'll probably need to rebase to make CI happy

@ArthurSens ArthurSens added the ready to merge Code review completed; ready to merge by maintainers label Nov 13, 2025
@songy23 songy23 merged commit 79702be into open-telemetry:main Nov 13, 2025
189 checks passed
@github-actions github-actions bot added this to the next release milestone Nov 13, 2025
aureleoules pushed a commit to DataDog/opentelemetry-collector-contrib that referenced this pull request Nov 14, 2025
…lemetry#44149)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

We should ideally empty a metric only if it has some datapoints in it.
Right now, we can emit empty metric if the `target_info` arrives first
and normal metrics arrives in subsequent request.

This PR adds a simple check to skip `ConsumeMetrics` if metric count is
0.

<!--Describe what testing was performed and which tests were added.-->
#### Testing

Updated tests

---------

Co-authored-by: Yang Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Code review completed; ready to merge by maintainers receiver/prometheusremotewrite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants