feat: Add connection

This commit is contained in:
sujit
2024-10-22 09:34:21 +05:45
parent 48918f1903
commit c2013827c6
12 changed files with 167 additions and 10 deletions

34
metrics/metrics.go Normal file
View File

@@ -0,0 +1,34 @@
package metrics
import (
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
var (
TasksProcessed = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "tasks_processed_total",
Help: "Total number of processed tasks.",
},
[]string{"status"},
)
TasksErrors = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "tasks_errors_total",
Help: "Total number of errors encountered while processing tasks.",
},
[]string{"node"},
)
)
func init() {
prometheus.MustRegister(TasksProcessed)
prometheus.MustRegister(TasksErrors)
}
func HandleHTTP() {
http.Handle("/metrics", promhttp.Handler())
}