Skip to content
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

feature: Customize status bundle_loading_duration_ns #7156

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jwu730-1
Copy link

@jwu730-1 jwu730-1 commented Nov 5, 2024

Why the changes in this PR are needed?

This PR enables the customization of the status configuration to set the bundle_loading_duration_ns buckets and resolves issue #6950

What are the changes in this PR?

extend the support of the prometheus config as below

status:
    prometheus: true
    prometheus_config:
      bundle_loading_duration_ns:
        buckets: [1, 1000, 10_000, 1e8]
  • inject the prometheus configuration during config parsing
  • updated bundleLoadDuration to be customized based on the config
  • during reconfig, re-register collector bundleLoadDuration
  • added unit test
  • small refactoring to make the change more readable

Notes to assist PR review:

Further comments:

Copy link

netlify bot commented Nov 5, 2024

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit d525ba6
🔍 Latest deploy log https://app.netlify.com/sites/openpolicyagent/deploys/672a41d16a74fd00084b8a33
😎 Deploy Preview https://deploy-preview-7156--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jwu730-1 jwu730-1 force-pushed the customize-bundle_loading_duration_ns-buckets branch from d525ba6 to fba2a44 Compare November 5, 2024 16:05
Copy link
Member

@ashutosh-narkar ashutosh-narkar left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @jwu730-1. One thing I notice in your implementation is that we're allowing users to configure the buckets and then defaulting to ExponentialBuckets. I understand this can be an implementation detail but if we simply allowed the user to configure the exponential bucket parameters (start, factor, count for example) and fallback to the current values, it would help to better understand the changes. This should serve your use-case as well and probably simplify the implementation. WDYT?

@jwu730-1
Copy link
Author

jwu730-1 commented Nov 6, 2024

Hi Ashutosh, thanks for your comment!

I think it would be flexible to set a customized bucket array. e.g. for our use case, we mostly need rough range e.g. 1s, 10s, 1min 3min (mostly)
Also, this configuration will be consistent with buckets setup as http_request_duration_seconds. I keep the default of ExponentialBuckets to be consistent as before in case someone alredy use that for their opa metrics.

Thanks for the contribution @jwu730-1. One thing I notice in your implementation is that we're allowing users to configure the buckets and then defaulting to ExponentialBuckets. I understand this can be an implementation detail but if we simply allowed the user to configure the exponential bucket parameters (start, factor, count for example) and fallback to the current values, it would help to better understand the changes. This should serve your use-case as well and probably simplify the implementation. WDYT?

@ashutosh-narkar
Copy link
Member

I think it would be flexible to set a customized bucket array. e.g. for our use case, we mostly need rough range e.g. 1s, 10s, 1min 3min (mostly)

Can't this be accomplished by setting the parameters of ExponentialBuckets?

@jwu730-1
Copy link
Author

jwu730-1 commented Nov 7, 2024

if using parameter of ExponentialBuckets, there would be possibly some unused buckets, we would like to eliminate the unused buckets to reduce the metrics size :)

Can't this be accomplished by setting the parameters of ExponentialBuckets?

@ashutosh-narkar
Copy link
Member

there would be possibly some unused buckets, we would like to eliminate the unused buckets to reduce the metrics size :)

Thanks for the context. Are you able to quantify this? If it's not significant, then going with the simpler implementation of configuring the exponential bucket parameters should suffice.

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.

2 participants