mirror of
https://github.com/postmannen/ctrl.git
synced 2025-04-09 10:24:17 +00:00
moved promProccessesVec into metrics
This commit is contained in:
parent
51f5543445
commit
26afb87705
4 changed files with 6 additions and 6 deletions
|
@ -146,7 +146,7 @@ func (p process) spawnWorker(procs *processes, natsConn *nats.Conn) {
|
|||
processName := processNameGet(p.subject.name(), p.processKind)
|
||||
|
||||
// Add prometheus metrics for the process.
|
||||
p.processes.promProcessesVec.With(prometheus.Labels{"processName": string(processName)})
|
||||
p.processes.metrics.promProcessesVec.With(prometheus.Labels{"processName": string(processName)})
|
||||
|
||||
// Start a publisher worker, which will start a go routine (process)
|
||||
// That will take care of all the messages for the subject it owns.
|
||||
|
|
|
@ -24,8 +24,6 @@ type processes struct {
|
|||
lastProcessID int
|
||||
// The instance global prometheus registry.
|
||||
metrics *metrics
|
||||
//
|
||||
promProcessesVec *prometheus.GaugeVec
|
||||
// Waitgroup to keep track of all the processes started
|
||||
wg sync.WaitGroup
|
||||
}
|
||||
|
@ -53,12 +51,12 @@ func newProcesses(ctx context.Context, metrics *metrics) *processes {
|
|||
})
|
||||
metrics.promRegistry.MustRegister(p.metrics.promTotalProcesses)
|
||||
|
||||
p.promProcessesVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||
p.metrics.promProcessesVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: "running_process",
|
||||
Help: "Name of the running process",
|
||||
}, []string{"processName"},
|
||||
)
|
||||
metrics.promRegistry.MustRegister(p.promProcessesVec)
|
||||
metrics.promRegistry.MustRegister(metrics.promProcessesVec)
|
||||
|
||||
return &p
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ type metrics struct {
|
|||
hostAndPort string
|
||||
//
|
||||
promTotalProcesses prometheus.Gauge
|
||||
//
|
||||
promProcessesVec *prometheus.GaugeVec
|
||||
}
|
||||
|
||||
// newMetrics will prepare and return a *metrics
|
||||
|
|
|
@ -448,7 +448,7 @@ func (m methodREQOpCommand) handler(proc process, message Message, nodeName stri
|
|||
}
|
||||
|
||||
// Remove the prometheus label
|
||||
proc.processes.promProcessesVec.Delete(prometheus.Labels{"processName": string(processName)})
|
||||
proc.processes.metrics.promProcessesVec.Delete(prometheus.Labels{"processName": string(processName)})
|
||||
|
||||
er := fmt.Errorf("info: stopProc: stopped %v on %v", sub, message.ToNode)
|
||||
sendErrorLogMessage(proc.toRingbufferCh, proc.node, er)
|
||||
|
|
Loading…
Add table
Reference in a new issue