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:
zeekay
2026-06-10 18:46:08 -07:00
parent 6a8f634217
commit 877c01ce50
2 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -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))
+5 -6
View File
@@ -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",
},