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

middleware(prometheus): use summaries instead of histograms #975

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

mmatczuk
Copy link
Contributor

@mmatczuk mmatczuk commented Dec 4, 2024

It is much more efficient to use summaries than histograms. This would give information on p50, p90 and p99.

Fixes #925

@mmatczuk mmatczuk requested a review from Choraden as a code owner December 4, 2024 13:53
It is much more efficient to use summaries than histograms.
This would give information on p50, p90 and p99.

Fixes #925
@budziam
Copy link
Contributor

budziam commented Dec 5, 2024

Can you provide information on how much time (*Prometheus).WroteResponse takes after this change?

@mmatczuk
Copy link
Contributor Author

mmatczuk commented Dec 5, 2024

Once we deploy we can do some new benchmarking, to compare apples to apples.
Histograms are very heavy, we disable them in general during collection, this would allow not to do that.

Comment on lines 9 to 12
# TYPE test_http_request_size_bytes summary
test_http_request_size_bytes{code="200",method="GET",quantile="0.5"} 5171
test_http_request_size_bytes{code="200",method="GET",quantile="0.9"} 102451
test_http_request_size_bytes{code="200",method="GET",quantile="0.99"} 102451
Copy link
Contributor

Choose a reason for hiding this comment

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

Request size does not look useful in a summary like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not about summary, but rather request size itself.
While duration may outline some slower requests, size does not matter that much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You suggest we remove it altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Counting the sizes requires some technical prep work (wrapping) we could get rid of.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hesitating, but it looks like we could get rid of it.

@mmatczuk
Copy link
Contributor Author

mmatczuk commented Dec 5, 2024

@Choraden PTAL

Copy link
Contributor

@Choraden Choraden left a comment

Choose a reason for hiding this comment

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

LGTM

@mmatczuk mmatczuk merged commit a002efc into main Dec 5, 2024
6 checks passed
@mmatczuk mmatczuk deleted the mmt/histograms branch December 5, 2024 13:31
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.

perf: slow (*Prometheus).WroteResponse
3 participants