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

fix: Coerce aggregation_temporality value to a symbol #1741

Merged

Conversation

kaylareopelle
Copy link
Contributor

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.

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.
@kaylareopelle kaylareopelle changed the title fix: Coerce aggregation_temporality to symbol fix: Coerce :aggregation_temporality to symbol Oct 7, 2024
@kaylareopelle kaylareopelle changed the title fix: Coerce :aggregation_temporality to symbol fix: Coerce aggregation_temporality value to a symbol Oct 7, 2024
@@ -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
Copy link
Contributor

@arielvalentin arielvalentin Oct 7, 2024

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@kaylareopelle kaylareopelle self-assigned this Oct 7, 2024
@kaylareopelle kaylareopelle merged commit 044336d into open-telemetry:main Oct 16, 2024
63 checks passed
@kaylareopelle kaylareopelle deleted the temporality-preference-fix branch October 16, 2024 20:06
@kaylareopelle kaylareopelle restored the temporality-preference-fix branch October 16, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants