-
Notifications
You must be signed in to change notification settings - Fork 805
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
Efficient Batch Observation Support for Native Histograms #1157
Comments
Thanks for the issue. If you are concerned about performance, try to look up the label values only once and then use the data point directly: DistributionDataPoint dataPoint = histogram.labelValues("a", "b");
for (Double value : observations) {
dataPoint.observe(value);
} There's documentation on this here: https://prometheus.github.io/client_java/getting-started/performance/. I don't think the |
Thanks for the response Fabian.
We have updated our code with the label lookup recommendation.
I don’t have performance results yet but I wanted to respond and say thanks before the weekend.
Acknowledge the observe call will have minimal cost. In our current use case we can be calling the observe call with the same value tens or hundreds of thousands of time in the same batch.
A batch observe function that achieves this in constant time is a feature that would help us achieve the scale we require.
Is this possible with the way Native Histograms are implemented today?
…On Thu, Oct 17, 2024 at 19:05, Fabian Stäber ***@***.***(mailto:On Thu, Oct 17, 2024 at 19:05, Fabian Stäber <<a href=)> wrote:
Thanks for the issue.
If you are concerned about performance, try to look up the label values only once and then use the data point directly:
DistributionDataPoint
dataPoint
=
histogram
.
labelValues
(
"a"
,
"b"
);
for
(
Double
value
:
observations
) {
dataPoint
.
observe
(
value
);
}
There's documentation on this here: https://prometheus.github.io/client_java/getting-started/performance/.
I don't think the observe() call has a measurable performance impact, I suspect it's the label value lookup.
—
Reply to this email directly, [view it on GitHub](#1157 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AKXWYRUNVGP46G4CYWRYOVLZ3737HAVCNFSM6AAAAABQCHP3JGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRQGE4TQMJTGY).
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I don't see a way to do this. I think insertion time will scale linearly with the number of observations, even if we implement a batch insert API. |
We have a use case where we need to record multiple observations of the same value in a Native Histogram.
Currently, this requires calling the observe method repeatedly in a loop:
This approach becomes inefficient when dealing with a large number of observations.
To improve performance, it would be helpful to have a method that allows batching these observations into a single call.
We would like to introduce a new method that accepts the value to observe and the number of times it should be recorded:
histogram.labelValues(labelValues).observe(value, observations);
This method would internally update the histogram as if observation number of values have been observed, but without the overhead of multiple method calls.
The text was updated successfully, but these errors were encountered: