1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

added metrics to process

This commit is contained in:
postmannen 2022-04-01 08:51:14 +02:00
parent 56b432f402
commit 86b3ef9e96
3 changed files with 6 additions and 2 deletions

View file

@ -103,6 +103,8 @@ type process struct {
signatures *signatures
// errorKernel
errorKernel *errorKernel
// metrics
metrics *metrics
}
// prepareNewProcess will set the the provided values and the default
@ -132,6 +134,7 @@ func newProcess(ctx context.Context, server *server, subject Subject, processKin
startup: newStartup(server),
signatures: server.signatures,
errorKernel: server.errorKernel,
metrics: server.metrics,
}
return proc

View file

@ -49,6 +49,7 @@ func newProcesses(ctx context.Context, server *server) *processes {
errorKernel: server.errorKernel,
configuration: server.configuration,
Signatures: server.signatures,
metrics: server.metrics,
}
// Prepare the parent context for the subscribers.

View file

@ -564,7 +564,7 @@ func (m methodREQOpProcessStop) handler(proc process, message Message, node stri
}
// Remove the prometheus label
proc.server.metrics.promProcessesAllRunning.Delete(prometheus.Labels{"processName": string(processName)})
proc.metrics.promProcessesAllRunning.Delete(prometheus.Labels{"processName": string(processName)})
txt := fmt.Sprintf("info: OpProcessStop: process stopped id: %v, method: %v on: %v", toStopProc.processID, sub, message.ToNode)
er := fmt.Errorf(txt)
@ -1011,7 +1011,7 @@ func (m methodREQErrorLog) getKind() Event {
// Handle the writing of error logs.
func (m methodREQErrorLog) handler(proc process, message Message, node string) ([]byte, error) {
proc.server.metrics.promErrorMessagesReceivedTotal.Inc()
proc.metrics.promErrorMessagesReceivedTotal.Inc()
// If it was a request type message we want to check what the initial messages
// method, so we can use that in creating the file name to store the data.