-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prometheus metrics for shell executor (#1330)
* real-time metrics from job executions --------- Co-authored-by: Andrejs Golevs <[email protected]> Co-authored-by: andreygolev <[email protected]>
- Loading branch information
1 parent
6bf1889
commit 29ad1fe
Showing
6 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
) | ||
|
||
const ( | ||
namespace = "dkron_job" | ||
) | ||
|
||
var ( | ||
cpuUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Name: "cpu_usage", | ||
Help: "CPU usage by job", | ||
}, | ||
[]string{"job_name"}) | ||
|
||
memUsage = promauto.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: namespace, | ||
Name: "mem_usage_kb", | ||
Help: "Current memory consumed by job", | ||
}, | ||
[]string{"job_name"}) | ||
) | ||
|
||
func updateMetric(jobName string, metricName *prometheus.GaugeVec, value float64) { | ||
metricName.WithLabelValues(jobName).Set(value) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters