-
Notifications
You must be signed in to change notification settings - Fork 862
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
Histogram Aggregation - core SDK implementation #2581
Histogram Aggregation - core SDK implementation #2581
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2581 +/- ##
===========================================
+ Coverage 0 87.12% +87.12%
- Complexity 0 2666 +2666
===========================================
Files 0 323 +323
Lines 0 8908 +8908
Branches 0 904 +904
===========================================
+ Hits 0 7761 +7761
- Misses 0 856 +856
- Partials 0 291 +291
Continue to review full report at Codecov.
|
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/jmh/java/io/opentelemetry/sdk/metrics/aggregator/BucketSearch.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/AggregatorFactory.java
Outdated
Show resolved
Hide resolved
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
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 am confused about the series of PRs sent. Can we start with a minimal PR that just adds the data type, then one PR that adds the aggregator, then PRs to plug it to the exporters
heh. this was my request to break up the original into 3 PRs. this is the first one in the series at the moment. |
sorry for the confusion. the original PR #2575 was divided up to 3 PR following the advice from the comments.
will update the description to make it more clear. if you think the |
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
...metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/DoubleHistogramAggregator.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableDoubleArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableDoubleArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableDoubleArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableLongArray.java
Outdated
Show resolved
Hide resolved
@@ -29,6 +29,8 @@ | |||
/* isMonotonic= */ false, AggregationTemporality.CUMULATIVE, Collections.emptyList()); | |||
private static final DoubleSummaryData DEFAULT_DOUBLE_SUMMARY_DATA = | |||
DoubleSummaryData.create(Collections.emptyList()); | |||
private static final DoubleHistogramData DEFAULT_DOUBLE_HISTOGRAM_DATA = | |||
DoubleHistogramData.create(AggregationTemporality.CUMULATIVE, Collections.emptyList()); |
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.
can we really hard-code CUMULATIVE here? Shouldn't it depend on how the aggregation is configured?
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.
it's a default & fallback value when we try to get the histogram data from an instance of MetricData
whose type is not HISTOGRAM
. I would assume something is wrong if this happens.
This seems pretty close to me, but I'd like our local metrics expert, @bogdandrutu to review before we merge. Also, it's worth noting that the OTel metrics data model is about to get a re-think, which could lead to needing to update things in here, depending on the outcome of those discussions. |
Thanks for the review and all the comments. as of the data model re-thinking, is there any reference that I could follow up? |
I think there are meetings being put on the public calendar where this is being discussed. I'd start by looking at recent metrics SIG meeting notes. |
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableDoubleArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/HistogramAccumulation.java
Outdated
Show resolved
Hide resolved
@beanliu sorry for taking too long to look into this. We just finished the tracing review, and we can now look into metrics again :) |
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/aggregator/HistogramAccumulation.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableDoubleArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/common/ImmutableLongArray.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/DoubleHistogramPointData.java
Outdated
Show resolved
Hide resolved
sdk/metrics/src/main/java/io/opentelemetry/sdk/metrics/data/DoubleHistogramPointData.java
Outdated
Show resolved
Hide resolved
@bogdandrutu thanks for the comments. not sure if I understand correctly, given the review is in progress, are u suggesting splitting this PR again? |
Unfortunately I have some time sensitive tasks at work for the next 2 days. I will come back to you asap. Regarding splitting. I know I review but was a very high level review to be honest because there are a lot of changes in this PR. But I think if you were to split probably would be way faster to merge this. |
the original PR #2575 was divided up to 3 PR following the advice from the comments.
they are not fully independent of each other and share some common commits, here's a simple description of their relationships in commits:
links of follow up PRs: #2582 #2583
Support fixed bucket histogram aggregation and exporting them with OTLP/Prometheus exporter.
Since the View API is not part of the public Metric API yet (optentelemetry-specification#466), there's no universal way to configure custom aggregators for different instruments. However, the
SdkMeterProvider
provides aregisterView
method which allows developers to specify aggregations for certain instruments. This suggests that we could do the following to achieve histogram aggregations:And we could upgrade the example to use View API once they are ready.