8000 feat: add path & method labels to prometheus metrics for current requests by ibetitsmike · Pull Request #17362 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: add path & method labels to prometheus metrics for current requests #17362

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

Merged
merged 7 commits into from
Apr 16, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added method to requests concurrent
  • Loading branch information
ibetitsmike committed Apr 15, 2025
commit d9f3dfa32e307c37e73e7fa5a2fa8320e51727a5
6 changes: 3 additions & 3 deletions coderd/httpmw/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func Prometheus(register prometheus.Registerer) func(http.Handler) http.Handler
Subsystem: "api",
Name: "concurrent_requests",
Help: "The number of concurrent API requests.",
}, []string{"path"})
}, []string{"method", "path"})
websocketsConcurrent := factory.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "coderd",
Subsystem: "api",
Expand Down Expand Up @@ -82,8 +82,8 @@ func Prometheus(register prometheus.Registerer) func(http.Handler) http.Handler

dist = websocketsDist
} else {
requestsConcurrent.WithLabelValues(path).Inc()
defer requestsConcurrent.WithLabelValues(path).Dec()
requestsConcurrent.WithLabelValues(method, path).Inc()
defer requestsConcurrent.WithLabelValues(method, path).Dec()

dist = requestsDist
distOpts = []string{method}
Expand Down
0