prometheus: move constants to a single file
Move the constants to a single file and export them. These can then later be used externally for future use with the ocm metrics.
This commit is contained in:
parent
a3a733a638
commit
8e82b223af
3 changed files with 25 additions and 25 deletions
7
internal/prometheus/constants.go
Normal file
7
internal/prometheus/constants.go
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package prometheus
|
||||
|
||||
const (
|
||||
Namespace = "image_builder"
|
||||
ComposerSubsystem = "composer"
|
||||
WorkerSubsystem = "worker"
|
||||
)
|
||||
|
|
@ -5,16 +5,11 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
const (
|
||||
namespace = "image_builder"
|
||||
subsystem = "composer"
|
||||
)
|
||||
|
||||
var (
|
||||
TotalRequests = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "total_requests",
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: ComposerSubsystem,
|
||||
Help: "total number of http requests made to osbuild-composer",
|
||||
})
|
||||
)
|
||||
|
|
@ -23,8 +18,8 @@ var (
|
|||
// update this to count all 500s
|
||||
ComposeFailures = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "total_failed_compose_requests",
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: ComposerSubsystem,
|
||||
Help: "total number of failed compose requests",
|
||||
})
|
||||
)
|
||||
|
|
@ -32,8 +27,8 @@ var (
|
|||
var (
|
||||
ComposeRequests = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "total_compose_requests",
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: ComposerSubsystem,
|
||||
Help: "total number of compose requests made to osbuild-composer",
|
||||
})
|
||||
)
|
||||
|
|
@ -41,8 +36,8 @@ var (
|
|||
var (
|
||||
httpDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Name: "http_duration_seconds",
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: ComposerSubsystem,
|
||||
Help: "Duration of HTTP requests.",
|
||||
Buckets: []float64{.025, .05, .075, .1, .2, .5, .75, 1, 1.5, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 20},
|
||||
}, []string{"path"})
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ import (
|
|||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
)
|
||||
|
||||
const workerSubsystem = "worker"
|
||||
|
||||
var (
|
||||
TotalJobs = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "total_jobs",
|
||||
Namespace: namespace,
|
||||
Subsystem: workerSubsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: WorkerSubsystem,
|
||||
Help: "Total jobs",
|
||||
}, []string{"type", "status", "tenant", "arch"})
|
||||
)
|
||||
|
|
@ -22,8 +20,8 @@ var (
|
|||
var (
|
||||
PendingJobs = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: "pending_jobs",
|
||||
Namespace: namespace,
|
||||
Subsystem: workerSubsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: WorkerSubsystem,
|
||||
Help: "Currently pending jobs",
|
||||
}, []string{"type", "tenant"})
|
||||
)
|
||||
|
|
@ -31,8 +29,8 @@ var (
|
|||
var (
|
||||
RunningJobs = promauto.NewGaugeVec(prometheus.GaugeOpts{
|
||||
Name: "running_jobs",
|
||||
Namespace: namespace,
|
||||
Subsystem: workerSubsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: WorkerSubsystem,
|
||||
Help: "Currently running jobs",
|
||||
}, []string{"type", "tenant"})
|
||||
)
|
||||
|
|
@ -40,8 +38,8 @@ var (
|
|||
var (
|
||||
JobDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Name: "job_duration_seconds",
|
||||
Namespace: namespace,
|
||||
Subsystem: workerSubsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: WorkerSubsystem,
|
||||
Help: "Duration spent by workers on a job.",
|
||||
Buckets: []float64{.1, .2, .5, 1, 2, 4, 8, 16, 32, 40, 48, 64, 96, 128, 160, 192, 224, 256, 320, 382, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2049},
|
||||
}, []string{"type", "status", "tenant", "arch"})
|
||||
|
|
@ -50,8 +48,8 @@ var (
|
|||
var (
|
||||
JobWaitDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
|
||||
Name: "job_wait_duration_seconds",
|
||||
Namespace: namespace,
|
||||
Subsystem: workerSubsystem,
|
||||
Namespace: Namespace,
|
||||
Subsystem: WorkerSubsystem,
|
||||
Help: "Duration a job spends on the queue.",
|
||||
Buckets: []float64{.1, .2, .5, 1, 2, 4, 8, 16, 32, 40, 48, 64, 96, 128, 160, 192, 224, 256, 320, 382, 448, 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2049},
|
||||
}, []string{"type", "tenant"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue