Add support for OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE environment variable#4667
Conversation
…or-Temporality-Preference
…or-Temporality-Preference
…or-Temporality-Preference
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4667 +/- ##
==========================================
- Coverage 85.08% 85.07% -0.02%
==========================================
Files 314 314
Lines 12725 12747 +22
==========================================
+ Hits 10827 10844 +17
- Misses 1898 1903 +5
|
| [InlineData("DELTA", MetricReaderTemporalityPreference.Delta)] | ||
| public void TestTemporalityPreferenceConfiguration(string configValue, MetricReaderTemporalityPreference expectedTemporality) | ||
| { | ||
| var configData = new Dictionary<string, string> { ["OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE"] = configValue }; |
There was a problem hiding this comment.
nit: Use the constant OtlpMetricExporterExtensions.OtlpMetricExporterTemporalityPreferenceEnvVarKey here (I'm assuming the tests can see internals)
There was a problem hiding this comment.
This was done on purpose. If someone accidentally changes the environment variable key name in the src file, then our tests should complain about it. If I use the const string defined in the src file then our tests would simply pass even when the value of the key is changed.
There was a problem hiding this comment.
I don't necessarily disagree with your logic, but it does break with all other envvar tests that I can recall seeing. Ex:
I would probably go with the constant to be consistent and follow DRY principle. If someone does have a valid reason to change it they should only have to do it in one spot.
But I made this a "nit" comment because I figured you might disagree 🤣 Up to you!
There was a problem hiding this comment.
I think we should think about what do we want to test? If we want to test, that a user a can configure something by providing a value for a particular string in the config, then our tests shouldn't be using the same const as the src file. Our tests would be too dynamic for their own good. 😄
CodeBlanch
left a comment
There was a problem hiding this comment.
LGTM with a CHANGELOG update
|
|
||
| ## Unreleased | ||
|
|
||
| * Added support for configuring the metric exporter's temporality using the |
There was a problem hiding this comment.
Good call out. I was thinking we should update that README once we have released a version of the package with this feature instead of doing that now.
Fixes #3756
Spec: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/sdk_exporters/otlp.md#additional-configuration
Changes
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCEenvironment variablePlease provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes