Skip to content
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

Update native histogram spec #2576

Merged
merged 3 commits into from
Feb 5, 2025
Merged

Update native histogram spec #2576

merged 3 commits into from
Feb 5, 2025

Conversation

beorn7
Copy link
Member

@beorn7 beorn7 commented Jan 29, 2025

Add the newly established behavior of rate, irate & friends.

Remove some obsolete TODOs.

@NeerajGartia21 @krajorama

@beorn7 beorn7 requested a review from krajorama January 29, 2025 17:01
@beorn7
Copy link
Member Author

beorn7 commented Jan 29, 2025

After some thinking, I came to the conclusion that the special behavior with counter reset between the 1st and 2nd histogram is so niche that I don't want to explicitly call it out in the regular PromQL documentation. I would argue that the now established behavior is the most reasonable one given how counter reset calculation works.

Copy link

@NeerajGartia21 NeerajGartia21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
Just a small suggestion.

These functions SHOULD be applied to either gauge histograms or counter
histograms as noted above. However, they all work with both flavors, but if at
least one histogram of an unsuitable flavor is contained in the range vector, a
warn-level annotation is added to the result.

All these functions return no result for series that contain a mix of float
samples and histogram samples within the range. A warn-level annotation is
added for each output element missing for that reason.
added for each output element missing for that reason. `idelta()` and `irate()`
only consider the last two samples in the range for this check.
Copy link

@NeerajGartia21 NeerajGartia21 Feb 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although the last line, "idelta() and irate() only consider the last two samples in the range for this check," clarifies that only the last two samples are considered, it would be better to convey this information in the initial sentence.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that the initial sentence is the general one that is valid for all these function. The sentence about idelta and irate is the exception to it for these two special functions. Maybe I can munge the last and first sentence together…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you like it now?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it looks good to me!
Thanks for the change.

idelta and irate are implemented now.

We also realized that the 1st histogram can be safely ignored if there
is a counter reset between the 1st and the 2nd histogram. Therefore,
we don't even have to error out on incompatible bucket layout in this
case.

Signed-off-by: beorn7 <[email protected]>
@beorn7
Copy link
Member Author

beorn7 commented Feb 5, 2025

With @NeerajGartia21 👍 , I'll merge this now. It's "just documentation". @krajorama if you have any concerns, let me know and I'll address them in a separate PR.

@beorn7 beorn7 merged commit 74cbcac into main Feb 5, 2025
5 checks passed
@beorn7 beorn7 deleted the beorn7/histogram branch February 5, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants