Skip to content

Fix metric type fluctuates between counter and gauge for a given metric - #710

Merged
chombium merged 1 commit into
cloudfoundry:mainfrom
weili-broadcom:main
Oct 27, 2025
Merged

Fix metric type fluctuates between counter and gauge for a given metric#710
chombium merged 1 commit into
cloudfoundry:mainfrom
weili-broadcom:main

Conversation

@weili-broadcom

Copy link
Copy Markdown
Contributor

Currently, if a counter metric's delta value fluctuates between 0 and non-0, it will lead to its metric type fluctuating between COUNTER and GAUGE in the otel prometheus exporter, thus getting dropped due to type conflict.

The solution is to keep counter metric to be counter type without considering its delta value

Description

Please include a summary of the change.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing performed?

  • Unit tests
  • Integration tests
  • Acceptance tests

Checklist:

  • This PR is being made against the main branch, or relevant version branch
  • I have made corresponding changes to the documentation
  • I have added testing for my changes

If you have any questions, or want to get attention for a PR or issue please reach out on the #logging-and-metrics channel in the cloudfoundry slack

Currently, if a counter metric's delta value fluctuates between 0 and non-0, it will lead to
its metric type fluctuating between COUNTER and GAUGE in the otel prometheus exporter, thus getting
dropped due to type conflict.

The solution is to keep counter metric to be counter type without considering its delta value

@mkocher mkocher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a participant in creating the old logic I think this makes more sense than what we did the first time

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Oct 27, 2025

@chombium chombium left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thanks for the fix @weili-broadcom

We are not using the deltas in the metrics. Although we have them, we don't set them anywhere, but we set the total values, which means the metrics are always counters.

I will wait for the ci job to finish and merge it afterwards

@chombium
chombium merged commit 7bb6f52 into cloudfoundry:main Oct 27, 2025
6 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants