-
Notifications
You must be signed in to change notification settings - Fork 812
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
Added DelegatingMetricData & TestMetricData Classes #6225
Added DelegatingMetricData & TestMetricData Classes #6225
Conversation
- Fixed builder to setName as well - Populating TestMetricData.data with an empty ImmutableSummaryData
983b970
to
d96cfd7
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6225 +/- ##
============================================
- Coverage 91.05% 90.87% -0.18%
- Complexity 5687 5698 +11
============================================
Files 621 623 +2
Lines 16642 16699 +57
Branches 1703 1711 +8
============================================
+ Hits 15153 15175 +22
- Misses 998 1024 +26
- Partials 491 500 +9 ☔ View full report in Codecov by Sentry. |
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 working on this @ThomasJazz!
* A {@link MetricData} which delegates all methods to another {@link MetricData}. Extend this class | ||
* to modify the {@link MetricData} that will be exported. | ||
*/ | ||
public abstract class DelegatingMetricData implements MetricData { |
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.
We may want to provide delegating version of the *PointData
interfaces as well (or maybe just make the existing immutable implementations public!). This PR will allow you to easily override resource, scope, name, description, unit, but you still need to bring your own implementation of the Data
and PointData
interfaces.
|
||
class DelegatingMetricDataTest { | ||
|
||
private static final class NoOpDelegatingMetricData extends DelegatingMetricData { |
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.
#nit: Can you move these static classes to the bottom of the file?
.setDescription("description") | ||
.setUnit("1") | ||
.setData(ImmutableSummaryData.empty()) | ||
.setType(MetricDataType.SUMMARY); |
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.
Not sure setting data and type to arbitrary selections is better than omitting them.
Also, the value of this is limited without usable Data
and PointData
implementations.
@jkwatson WDYT about adding static create methods to all the interfaces in the io.opentelemetry.sdk.metrics.data? These could return the internal immutable implementations, without requiring that we make all those classes public.
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.
hey @jack-berg it looks like all the immutable implementations already have public create
methods. do you mind share a bit more detail on the last comment above?
would it look better to just return the AutoValue_TestMetricData.Builder()
form the builder()
method?
@ThomasJazz I'm going to close this because there hasn't been any activity in several months. Feel free to re-open if you pick this up again. |
Hello! This is my first attempt to contribute to an open source project, so pls be nice :). I have read through the contributor steps, but I apologize in advance if I have missed anything.