-
Notifications
You must be signed in to change notification settings - Fork 825
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(exporter-metrics-otlp-http): add option to set the exporter aggregation preference #4409
feat(exporter-metrics-otlp-http): add option to set the exporter aggregation preference #4409
Conversation
@pichlermarc Can you review this and advise on tests perhaps? |
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.
Thanks for tackling this @AkselAllas
In it's current state, I think this might not yet work, fortunately it'll be easy to fix (see comment) 🙂
For tests, just having a few tests in this file, which tests if the aggregationSelector calls the selector supplied to the constructor, and returns it's results should be sufficient. A further test to check that it returns the default aggregation preference when nothing is supplied would also be nice. 🙂
if (config?.aggregationSelector) { | ||
this._otlpExporter.aggregationSelector = config.aggregationSelector | ||
} |
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.
This sets the selector to the internal exporter, so It won't be used.
We'd have to do something like here where we implement selectAggregation and then call the selector from the config.
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.
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.
Yep that's in the PeriodicExportingMetricReader
accessing any PushMetricExporter
that's passed in (which, in this case is an instance of the class in this file). However this code here sets it on_otlpExporter
(which is just a field of this class that is used internally), so it's never picked up in the PeriodicExportingMetricReader
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.
Sorry, I should have had that comment as draft :) I was already fixing that part of the missing code.
4819ba2
to
e0f076d
Compare
Running
Any ideas? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4409 +/- ##
=======================================
Coverage 92.23% 92.23%
=======================================
Files 336 336
Lines 9525 9533 +8
Branches 2020 2022 +2
=======================================
+ Hits 8785 8793 +8
Misses 740 740
|
experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
Show resolved
Hide resolved
0fad7d0
to
396b6d1
Compare
That file is usually generated as part of |
86df50a
to
b80e84d
Compare
@pichlermarc Is there anything to improve here? Or is there something we are waiting after? If merged, any idea when a release could be expected? Along with next release of @opentelemetry/instrumentation I assume? |
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.
A few more comments, then this should be good to merge. 🙂
You can expect this to release within the next two weeks (which is the rough release-schedule we try to keep).
|
||
it('aggregationSelector returns the default aggregation preference when nothing is supplied', () => { | ||
const exporter = new OTLPMetricExporter({ | ||
temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, |
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 think we can remove it since it does not affect the test in any way and we don't assert on it. 🙂
temporalityPreference: AggregationTemporalityPreference.CUMULATIVE, |
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.
Done.
experimental/packages/opentelemetry-exporter-metrics-otlp-http/src/OTLPMetricExporterBase.ts
Show resolved
Hide resolved
|
||
export interface OTLPMetricExporterOptions extends OTLPExporterConfigBase { | ||
temporalityPreference?: | ||
| AggregationTemporalityPreference | ||
| AggregationTemporality; | ||
aggregationSelector?: AggregationSelector; |
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 think preference may be the better name as it can be overwritten by a view.
aggregationSelector?: AggregationSelector; | |
aggregationPreference?: AggregationSelector; |
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.
Done.
experimental/CHANGELOG.md
Outdated
@@ -8,6 +8,8 @@ All notable changes to experimental packages in this project will be documented | |||
|
|||
### :rocket: (Enhancement) | |||
|
|||
* feat(exporter-metrics-otlp-http) [#4409](https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas |
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.
* feat(exporter-metrics-otlp-http) [#4409](https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas | |
* feat(exporter-metrics-otlp-http): add option to set the exporter aggregation preference [#4409](https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas |
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.
Done.
a2246ed
to
590392d
Compare
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.
Looks good, thanks for taking care of this 🙂
Context is here
Should probably get some tests.