Skip to content

add optional cache for GetMetricKind calls #867

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 1 commit into
base: master
Choose a base branch
from

Conversation

DP19
Copy link

@DP19 DP19 commented Apr 9, 2025

fixes #866

This allows responses for MetricDescriptors.Get to be cached as to not hit the quota limit described in the linked issue

@@ -509,9 +512,20 @@ func (t *Translator) ListMetricDescriptors(fallbackForContainerMetrics bool) *st
Filter(filter)
}

type cachedMetricInfo struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, updated. I put some initial values here that i think would work. Let me know if we want to make this configurable.

Copy link
Contributor

@CatherineF-dev CatherineF-dev Apr 14, 2025

Choose a reason for hiding this comment

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

Let me know if we want to make this configurable.

Yes, it will be better to make it configurable. And this feature can be turned off by default.

If we find more users are complaining this issue, we can make it turned on by default later.

Copy link
Contributor

Choose a reason for hiding this comment

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

MetricKindCacheSize:

  • When it's 0, it doesn't use the cache
  • When it's not 0, it uses the cache

@DP19 DP19 changed the title cache GetMetricKind responses add optional cache for GetMetricKind calls Apr 14, 2025
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.

Hitting internal google quota "monitoring.googleapis.com/descriptor_read_requests"
2 participants