Skip to content

Commit 0665a6c

Browse files
authored
feat: add metric for provisioner daemons (#7858)
1 parent 4954052 commit 0665a6c

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

cli/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
822822
}
823823
provisionerDaemons = append(provisionerDaemons, daemon)
824824
}
825+
provisionerdMetrics.Runner.NumDaemons.Set(float64(len(provisionerDaemons)))
825826

826827
shutdownConnsCtx, shutdownConns := context.WithCancel(ctx)
827828
defer shutdownConns()

provisionerd/provisionerd.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ func NewMetrics(reg prometheus.Registerer) Metrics {
140140
Name: "jobs_current",
141141
Help: "The number of currently running provisioner jobs.",
142142
}, []string{"provisioner"}),
143+
NumDaemons: auto.NewGauge(prometheus.GaugeOpts{
144+
Namespace: "coderd",
145+
Subsystem: "provisionerd",
146+
Name: "num_daemons",
147+
Help: "The number of provisioner daemons.",
148+
}),
143149
JobTimings: auto.NewHistogramVec(prometheus.HistogramOpts{
144150
Namespace: "coderd",
145151
Subsystem: "provisionerd",

provisionerd/runner/runner.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ type Runner struct {
8888

8989
type Metrics struct {
9090
ConcurrentJobs *prometheus.GaugeVec
91+
NumDaemons prometheus.Gauge
9192
// JobTimings also counts the total amount of jobs.
9293
JobTimings *prometheus.HistogramVec
9394
// WorkspaceBuilds counts workspace build successes and failures.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy