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

feat: Explicit bucket boundary advisory parameter #1703

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

Conversation

kaylareopelle
Copy link
Contributor

@kaylareopelle kaylareopelle commented Aug 28, 2024

The advisory parameter :explicit_bucket_boundaries allows instrumentation authors to set bucket boundaries for histograms that differ from the default bucket set. Since this only applies to histograms, advice is not explicitly assigned in other instruments, so shared methods have an optional argument that defaults to nil.

Any key passed to advice will be accepted, but only the :explicit_bucket_boundaries symbol will have an effect.

Advice is used by instrumentation for metrics configuration, similar to how views are used by users.

Relates to #1686

The advisory parameter explicit_bucket_boundaries allows instrumentation
authors to set bucket boundaries for histograms that differ from the
default bucket set. Since this only applies to histograms, advice
is not explicitly assigned in other instruments, however, shared methods
will have an empty hash assigned as the default argument.

Any key passed to advice will be accepted, but only the
:explicit_bucket_boundaries symbol will have an effect.
The API doesn't have the functionality tested
@@ -8,19 +8,22 @@ module OpenTelemetry
module Internal
# @api private
class ProxyInstrument
def initialize(kind, name, unit, desc, callable)
def initialize(kind, name, unit, desc, callable, advice = nil)
Copy link
Contributor Author

@kaylareopelle kaylareopelle Aug 28, 2024

Choose a reason for hiding this comment

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

I'm not sure what the ideal default argument is. We expect advice to be a hash when it's present, but that might cause a lot of unnecessary object allocations. I'm leaning to nil for now, but open to discussion.

Copy link
Member

Choose a reason for hiding this comment

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

Would a constant, empty, frozen hash be an option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! Updated in d2318b0

@@ -8,19 +8,22 @@ module OpenTelemetry
module Internal
# @api private
class ProxyInstrument
def initialize(kind, name, unit, desc, callable)
def initialize(kind, name, unit, desc, callable, advice = nil)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, advice is shorter than advisory_parameters, so that's why I chose that word. However, it's not the latest terminology used in the spec. I'm happy to change to advisory_parameters if that's preferred. Perhaps some documentation would clarify things.

kaylareopelle and others added 5 commits September 4, 2024 12:29
must_equal(nil) will be removed in Minitest 6
…e/opentelemetry-ruby into metrics-advisory-parameters
Assign the advice instance variable in histograms only.
Advice will default to nil in all cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

2 participants