-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.go
More file actions
52 lines (43 loc) · 1.56 KB
/
Copy pathmetrics.go
File metadata and controls
52 lines (43 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package relay
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
tasksProcessed = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "relay",
Name: "tasks_processed_total",
Help: "Number of tasks processed successfully.",
}, []string{"queue", "type"})
tasksFailed = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "relay",
Name: "tasks_failed_total",
Help: "Number of task executions that returned an error.",
}, []string{"queue", "type"})
tasksRetried = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "relay",
Name: "tasks_retried_total",
Help: "Number of tasks scheduled for retry.",
}, []string{"queue", "type"})
tasksArchived = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "relay",
Name: "tasks_archived_total",
Help: "Number of tasks moved to the archive after exhausting retries.",
}, []string{"queue", "type"})
tasksInProgress = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "relay",
Name: "tasks_in_progress",
Help: "Number of tasks currently being processed.",
}, []string{"queue"})
processingDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
Namespace: "relay",
Name: "task_duration_seconds",
Help: "Time spent processing a task.",
Buckets: prometheus.DefBuckets,
}, []string{"queue", "type"})
)
func MetricsHandler() http.Handler {
return promhttp.Handler()
}