-
Notifications
You must be signed in to change notification settings - Fork 240
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
fix: Coerce aggregation_temporality value to a symbol #1741
fix: Coerce aggregation_temporality value to a symbol #1741
Conversation
The OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE env var sets the temporality as a string. However, checks throughout the metrics SDK and the OTLP exporter expect the temporality to be a symbol. Now, when aggregations that use this env var are initialized, the temporality will be coerced into a symbol.
:aggregation_temporality
to symbol
:aggregation_temporality
to symbol@@ -15,7 +15,7 @@ class Sum | |||
|
|||
def initialize(aggregation_temporality: ENV.fetch('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE', :delta)) | |||
# TODO: the default should be :cumulative, see issue #1555 | |||
@aggregation_temporality = aggregation_temporality | |||
@aggregation_temporality = aggregation_temporality.to_sym |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-Blocking Comment:
Can this be user specified or is there a constraint on the temporality preference?
I.e. should this be open ended or should it be a sort of enum object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! I think an enum would be a good addition here.
According to the spec, the only valid values here are :delta
or :cumulative
. The OTLP exporter will fall back to unspecified
otherwise.
We don't have support for :cumulative
aggregation yet, so really, the only true option should just be :delta
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue to fix this as a follow-up: #1742
Fetching the
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
environment variable when setting the:aggregation_temporality
on some aggregation classes (sum, explicit bucket histogram) sets the temporality as a string. However, checks throughout the metrics SDK and the OTLP exporter expect the temporality to be a symbol.This would cause applications that set the environment variable and used the OTLP exporter to have the aggregation temporality set to
Unspecified
.Now, when aggregations that use this environment variable are initialized, the temporality will be coerced into a symbol.