-
Notifications
You must be signed in to change notification settings - Fork 843
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
Prototype of a very basic Aggregation-configuration API in the SDK. #1412
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1412 +/- ##
============================================
- Coverage 92.50% 92.46% -0.04%
- Complexity 939 955 +16
============================================
Files 117 119 +2
Lines 3348 3385 +37
Branches 270 274 +4
============================================
+ Hits 3097 3130 +33
- Misses 169 173 +4
Partials 82 82
Continue to review full report at Codecov.
|
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.
API seems reasonable to me, guess some more javadoc to add?
descriptor, meterProviderSharedState, meterSharedState, aggregation); | ||
Aggregation aggregation = specification.aggregation(); | ||
|
||
if (Temporality.CUMULATIVE == specification.temporality()) { |
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.
Think we'd usually order specification.temporality() ==
or use a switch
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've seen it both ways...I don't think there's much of a standard, or even agreement on this. Back in the day, I'd use .equals()
even for enums, since someone could change it from an enum and break code if you use ==
. :)
sdk/src/main/java/io/opentelemetry/sdk/metrics/ViewRegistry.java
Outdated
Show resolved
Hide resolved
sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java
Outdated
Show resolved
Hide resolved
sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java
Outdated
Show resolved
Hide resolved
public abstract Temporality temporality(); | ||
|
||
/** An enumeration which describes the time period over which metrics should be aggregated. */ | ||
public enum Temporality { |
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 but it seems like this could be applicable as a top level enum (outside the realm of views)
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.
possibly, yes. I think this will become a top-level concept eventually, so if/when that happens, we'll definitely make it more first-class.
sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java
Outdated
Show resolved
Hide resolved
sdk/src/main/java/io/opentelemetry/sdk/metrics/view/ViewSpecification.java
Outdated
Show resolved
Hide resolved
|
||
private MeterSdkProvider(Clock clock, Resource resource) { | ||
this.registry = | ||
new MeterSdkComponentRegistry( | ||
MeterProviderSharedState.create(clock, resource), new ViewRegistry()); | ||
MeterProviderSharedState.create(clock, resource), viewRegistry); |
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.
Wondering why we don't want ViewRegistry
per MeterSdk
instance level? What if I have Metric instruments with the same type and name but I want it have different custom aggregation & temporality on different instrumentationName
?
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.
The SDK user won't in general know what named Meters are available, so I don't know how you would access the specific Meter in order to have a registry at that level. How were you thinking that an operator would know how to use this if the API were available only on the individual Meters?
Co-authored-by: Anuraag Agrawal <[email protected]>
…ication.java Co-authored-by: Anuraag Agrawal <[email protected]>
…ication.java Co-authored-by: Anuraag Agrawal <[email protected]>
…ication.java Co-authored-by: Anuraag Agrawal <[email protected]>
…ication.java Co-authored-by: Anuraag Agrawal <[email protected]>
@jkwatson what needs to happen to make progress here? I feel this is a blocker for my work in adding an additional aggregation option. |
Well, aside from a rebase... we'd have to decide this was something we wanted to implement, even though it's not really spec'd at this point. |
closing in favor of #2037 (rebasing this proved messy and I no longer work for NR, so didn't want to use their fork as the basis for the PR) |
Note: related OTEP: open-telemetry/oteps#126
This prototype supports the following:
An example of how you could use it: