Add native histogram support#304
Open
howardjohn wants to merge 2 commits into
Open
Conversation
Add native-only histograms and histograms that expose both classic and native buckets. Encode native sparse bucket spans and deltas through the Prometheus protobuf encoder while keeping text and OpenMetrics protobuf behavior on the classic representation when available. Signed-off-by: John Howard <john.howard@solo.io>
dc631bf to
d4882eb
Compare
|
Related issue #150 |
Collaborator
krisztianfekete
left a comment
There was a problem hiding this comment.
This looks great, I am planning to do some actual testing as well soon, but added a couple of comments/questions in the meantime!
| _native: NativeHistogram<'_>, | ||
| ) -> Result<(), std::fmt::Error> { | ||
| if buckets.is_empty() { | ||
| return Err(std::fmt::Error); |
Collaborator
There was a problem hiding this comment.
Can we have a typed error here and surface that the text encoder doesn't support native histograms?
Contributor
Author
There was a problem hiding this comment.
Not really. the EncodeMetric itself has std::fmt::Error as the error type which conveys no information. To do so we would have to modify the public trait which doesn't seem in scope for this.
Signed-off-by: John Howard <john.howard@solo.io>
0c534c9 to
1931f5b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for native histograms using the new prometheus protobuf support recently merged.
The implementation is basically 1:1 lifted from the Golang implementation as much as possible, including tests.
Users can make any of the 3: classic only, native only, or classic + native histogram.