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

Make the HTTP size buckets usable #595

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions httpbp/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ const (
endpointLabel = "http_endpoint"
)

var payloadSizeBuckets = []float64{
reptile-deer-66 marked this conversation as resolved.
Show resolved Hide resolved
100, // 100 B
500, // 500 B
1 << 10, // 1 KiB
4 << 10, // 4 KiB
10 << 10, // 10 KiB
50 << 10, // 50 KiB
100 << 10, // 100 KiB
500 << 10, // 500 KiB
1 << 20, // 1 MiB
5 << 20, // 5 MiB
10 << 20, // 10 MiB
50 << 20, // 50 MiB
100 << 20, // 100 MiB
}

var (
serverLabels = []string{
methodLabel,
Expand All @@ -32,13 +48,13 @@ var (
serverRequestSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_request_size_bytes",
Help: "Request size",
Buckets: prometheusbp.DefaultLatencyBuckets,
Buckets: payloadSizeBuckets,
}, serverLabels)

serverResponseSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_response_size_bytes",
Help: "Response size",
Buckets: prometheusbp.DefaultLatencyBuckets,
Buckets: payloadSizeBuckets,
}, serverLabels)

serverTimeToWriteHeader = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Expand Down