deps: prometheus/client_golang → luxfi/metric
Mechanical migration following the beego v2.3.8 fork precedent (bc7b075). Same exposition surface, zero prometheus/client_golang in the dep graph.
This commit is contained in:
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/hanzoai/runner/pkg/api/controllers"
|
||||
"github.com/hanzoai/runner/pkg/api/docs"
|
||||
"github.com/hanzoai/runner/pkg/api/middlewares"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
metric "github.com/luxfi/metric"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
@@ -85,7 +85,7 @@ func (a *ApiServer) Start() error {
|
||||
|
||||
public := a.router.Group("/")
|
||||
public.GET("", controllers.HealthCheck)
|
||||
public.GET("/metrics", gin.WrapH(promhttp.Handler()))
|
||||
public.GET("/metrics", gin.WrapH(metric.NewHTTPHandler(metric.DefaultGatherer, metric.HandlerOpts{})))
|
||||
|
||||
if config.GetEnvironment() == "development" {
|
||||
public.GET("/api/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
metric "github.com/luxfi/metric"
|
||||
)
|
||||
|
||||
type PrometheusOperationStatus string
|
||||
@@ -18,8 +17,8 @@ const (
|
||||
// Define your metrics
|
||||
var (
|
||||
// Histogram to track duration of container operations
|
||||
ContainerOperationDuration = promauto.NewHistogramVec(
|
||||
prometheus.HistogramOpts{
|
||||
ContainerOperationDuration = metric.NewHistogramVec(
|
||||
metric.HistogramOpts{
|
||||
Name: "container_operation_duration_seconds",
|
||||
Help: "Time taken for container operations in seconds",
|
||||
// Buckets optimized for detecting anomalies in operation durations
|
||||
@@ -29,8 +28,8 @@ var (
|
||||
)
|
||||
|
||||
// Counter to track occurrence of container operations with status
|
||||
ContainerOperationCount = promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
ContainerOperationCount = metric.NewCounterVec(
|
||||
metric.CounterOpts{
|
||||
Name: "container_operation_total",
|
||||
Help: "Total number of container operations",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user