0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-17 11:02:53 +02:00

test out non default buckets

This commit is contained in:
TheFox0x7 2025-07-07 00:33:52 +02:00
parent f69e18f375
commit 206eb3e16f
No known key found for this signature in database
GPG Key ID: 6CA33903484AF7C2
2 changed files with 9 additions and 12 deletions

12
go.mod
View File

@ -97,9 +97,8 @@ require (
github.com/opencontainers/image-spec v1.1.1
github.com/pkg/errors v0.9.1
github.com/pquerna/otp v1.4.0
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/common v0.60.1
github.com/prometheus/client_golang v1.22.0
github.com/prometheus/common v0.63.0
github.com/quasoft/websspi v1.1.2
github.com/redis/go-redis/v9 v9.7.3
github.com/robfig/cron/v3 v3.0.1
@ -221,12 +220,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/libdns/libdns v0.2.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/libdns/libdns v1.0.0-beta.1 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/markbates/going v1.0.3 // indirect
@ -249,11 +243,7 @@ require (
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rhysd/actionlint v1.7.3 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.1 // indirect
github.com/rhysd/actionlint v1.7.7 // indirect
github.com/rivo/uniseg v0.4.7 // indirect

View File

@ -29,9 +29,13 @@ const (
httpRequestMethod = "http_request_method"
httpResponseStatusCode = "http_response_status_code"
httpRoute = "http_route"
kb = 1000
mb = kb * kb
)
// reference: https://opentelemetry.io/docs/specs/semconv/http/http-metrics/#http-server
var (
sizeBuckets = []float64{1 * kb, 2 * kb, 5 * kb, 10 * kb, 100 * kb, 500 * kb, 1 * mb, 2 * mb, 5 * mb, 10 * mb}
// reqInflightGauge tracks the amount of currently handled requests
reqInflightGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "http",
@ -43,8 +47,9 @@ var (
reqDurationHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "http",
Subsystem: "server",
Name: "request_duration",
Name: "request_duration_seconds", // diverge from spec to store the unit in metric.
Help: "Measures the latency of HTTP requests processed by the server",
Buckets: []float64{0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300}, // based on dotnet buckets https://github.com/open-telemetry/semantic-conventions/issues/336
}, []string{httpRequestMethod, httpResponseStatusCode, httpRoute})
// reqSizeHistogram tracks the size of request
reqSizeHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
@ -52,6 +57,7 @@ var (
Subsystem: "server_request",
Name: "body_size",
Help: "Size of HTTP server request bodies.",
Buckets: sizeBuckets,
}, []string{httpRequestMethod, httpResponseStatusCode, httpRoute})
// respSizeHistogram tracks the size of the response
respSizeHistogram = promauto.NewHistogramVec(prometheus.HistogramOpts{
@ -59,6 +65,7 @@ var (
Subsystem: "server_response",
Name: "body_size",
Help: "Size of HTTP server response bodies.",
Buckets: sizeBuckets,
}, []string{httpRequestMethod, httpResponseStatusCode, httpRoute})
)