-
Notifications
You must be signed in to change notification settings - Fork 468
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
AggregationSelector is not needed anymore #2085
AggregationSelector is not needed anymore #2085
Conversation
|
This looks okay to me, thanks. We need have CLA agreement signed (one-time) before accepting any changes to the repo, as this is the mandatory requirement from OpenTelemetry/Linux-Foundation organization which hosts the project. Though Views allow one to change default aggregation, I haven't observed demand for that capability yet!. That capability is not exposed in OTel .NET Metrics, and no one has ever asked for it so far (its been GA since late 2021). We could even remove that capability from OTel Rust too for first stable release to keep public API surface minimal, but this can be separately discussed. |
465a021
to
9a02aab
Compare
Thanks for guidance and your input! For my use case it was enough when In my opinion, supporting 0-N number of views was a mistake, because it's not obvious how things behave without reading very carefully SDK (or even better source code), and what is worse, you'll get warnings if you use
if stream.matches_name("histogram*") {
return stream.aggregation(Sum)
}
if stream.scope.name =="mylib" {
return stream.allowed_attributes([Key::new("size")])
}
if stream.scope.name == "otherlib" && if stream.name == "my_metric" {
return stream.description("even nicer description for other lib")
.unit("X")
}
stream // leave unchanged default
// or .stream.aggregation(Drop) to drop the rest Anyway, thanks again, and I'll try to get CLA signed. |
9a02aab
to
35f1c8c
Compare
No there is no other way. OTel .NET simply don't allow one to change aggregation. Ofcourse it does allow one to change HistogramBuckets, and also flip between Explicit vs Exponential Histogram, but thats about it. One cannot take a Counter and ask it to be aggregated as Histogram and things like this. |
@fraillt Your concerns are valid. Views does have valid use cases, but it is also true that its somewhat easy to mis-use and cause issues. My original plan was to remove Views completely from 1st stable release.. It is entirely possible we do that, or possible that we trim it down. The most common use case for Views is to change Histogram Buckets - @utpilla is looking at fixing #1241 so one can change Histogram Buckets without having to learn about Views. Is your scenario also just about customizing histogram buckets? Irrespective of this, the direction of this PR is good. |
Yes, currently I need to customize histogram buckets, but I actually I might want to use rename or aggregation drop functionality as well... :) Anyway, what should I do to finish my work? Is updating appropriate CHANGELOG.md files would be enough? |
Anyway, what should I do to finish my work? Is updating appropriate CHANGELOG.md files would be enough? Please pick latest main, and see if the CI turns green. I'll get back to reviewing this after the #2088 release is done! Thanks for waiting! |
35f1c8c
to
2ec0110
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2085 +/- ##
=======================================
+ Coverage 78.0% 78.2% +0.2%
=======================================
Files 121 121
Lines 20936 20849 -87
=======================================
- Hits 16332 16314 -18
+ Misses 4604 4535 -69 ☔ View full report in Codecov by Sentry. |
This test is flaky.
Do you know if anyone is working on it? What should I do? How to reproduce:
diff --git a/opentelemetry-prometheus/Cargo.toml b/opentelemetry-prometheus/Cargo.toml
index 3bbe65e3..22a33737 100644
--- a/opentelemetry-prometheus/Cargo.toml
+++ b/opentelemetry-prometheus/Cargo.toml
@@ -21,13 +21,13 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
once_cell = { workspace = true }
-opentelemetry = { version = "0.24", default-features = false, features = ["metrics"] }
-opentelemetry_sdk = { version = "0.24", default-features = false, features = ["metrics"] }
+opentelemetry = { default-features = false, features = ["metrics"], path = "../opentelemetry" }
+opentelemetry_sdk = { default-features = false, features = ["metrics"], path = "../opentelemetry-sdk" }
prometheus = "0.13"
protobuf = "2.14"
[dev-dependencies]
-opentelemetry-semantic-conventions = { version = "0.16" }
+opentelemetry-semantic-conventions = { path = "../opentelemetry-semantic-conventions" }
http-body-util = { workspace = true }
hyper = { workspace = true, features = ["full"] }
hyper-util = { workspace = true, features = ["full"] }
After investigation with
|
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 changes look good. Thank you for your contirbution!
Requesting changes just to remove the Prometheus exporter changes from this PR. Please submit that as a separate PR, and we can get it in, and do a release of Prometheus as well.
3fa603b
to
299c1ba
Compare
299c1ba
to
0f016ce
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.
Thanks a lot for your contributions! Would love to see more contributions.
Hi folks, I just had a miserable time upgrading our This change made in into the changelog for The changelog entry that does exist for Views seem to be under-documented in general. While #1060 exists and examples were added for usage from In the end, I think I made it work without using an When reading about views in #1849, I stumbled across #1849 (comment), which seems to indicate that this method of customization will stop working in upcoming releases, maybe being re-added in the future. You again suggest using #1241 instead, but at this point I am just lost as to what plugs in where. Apologies for highjacking this PR for my comments, but it does feel like the OTLP crate got the short end of the stick with these changes. Putting aside my confusion, imo at minimum a changelog entry should be added for the breaking change in |
Hi, |
@domenicquirl Apologies for the confusion! Since this was more of an API/SDK feature than OTLP exporter, we didn't update the Changelog for OTLP Exporter. However, as you pointed out, we could have done a better job at updating the SDK changelog. The best way to do customize histogram buckets is through the opentelemetry-rust/examples/metrics-basic/src/main.rs Lines 86 to 93 in 16c0e10
Just FYI Histogram Hint API only covers customization of buckets. Other aggregation customizations would still be covered by Views. We would be focusing on improving and fixing Views after the stable release. |
Thanks for following up! Very much appreciate your acknowledgement regarding the changelog.
@utpilla I've seen both the hint / advisory API and the example by now, but I'm actually using It might be that this is fine and That said, I think even for users of just |
@domenicquirl Thanks for taking time reporting the issue (very well written!). Couple of follow ups:
|
@cijothomas sure thing! We are only using the selector (or now a view that does the same thing) to customize histogram buckets, but this is pretty much required since the time intervals we're measuring are expected to be quite short. This is true in our application for both the things that are measured in seconds and the ones measured in ms. So while we could scale up the values in seconds to ms to better match the default buckets, those go like 0, 5, 10, and then up to 10000 which really doesn't fit small timescales. To give a concrete example, we use https://crates.io/crates/tokio-metrics which tracks metrics like "time to first poll", "time to start running again after being woken up", and "time taken when polled" for Besides that, as I mentioned previously we are recording the metrics through Thus, I think our primary motivation here could be summed up by saying that customizing the |
Hello,
I'm not sure if this is a right way to approach this, but basically I think that
AggregationSelector
trait, and manywith_aggregation_selector
configuration methods on various public SDK types is not needed anymore, because newly introduced Views feature fully replaces this trait and removingAggregationSelector
only makes things simpler/more understandable.I created this PR as a proof to show that we can simply remove it without loosing any current functionality.
The only issue is this sentence in SDK:
If I'm not missing anything, I think it could be changed to:
What do you think, do you agree, or I'm missing something important here?
Changes
AggregationSelector
traitwith_aggregation_selector
configuration function from many public types.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes