Skip to content
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

feat: add exit_code label to execution_done_count #1576

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions builtin/bins/dkron-executor-shell/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"log"
"strconv"
"time"

"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -40,7 +41,7 @@ var (
Name: "execution_done_count",
Help: "Job Execution Counter",
},
[]string{"job_name"})
[]string{"job_name", "exit_code"})

jobExitCode = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Expand All @@ -60,10 +61,11 @@ func CollectProcessMetrics(jobname string, pid int, quit chan int) {
// log.Println("Exit code received and quit channel closed.")
return
}
exitCodeStr := strconv.Itoa(exitCode)
cpuUsage.WithLabelValues(jobname).Set(0)
memUsage.WithLabelValues(jobname).Set(0)
jobExecutionTime.WithLabelValues(jobname).Set(0)
jobDoneCount.WithLabelValues(jobname).Inc()
jobDoneCount.WithLabelValues(jobname, exitCodeStr).Inc()
jobExitCode.WithLabelValues(jobname).Set(float64(exitCode))
default:
cpu, mem, err := GetTotalCPUMemUsage(pid)
Expand Down
Loading