Files
runtime/apps/runner/pkg/common/metrics.go
zeekay 065ad13739 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.
2026-06-10 18:46:08 -07:00

39 lines
1.0 KiB
Go

// Copyright 2025 Hanzo Industries Inc.
// SPDX-License-Identifier: AGPL-3.0
package common
import (
metric "github.com/luxfi/metric"
)
type PrometheusOperationStatus string
const (
PrometheusOperationStatusSuccess PrometheusOperationStatus = "success"
PrometheusOperationStatusFailure PrometheusOperationStatus = "failure"
)
// Define your metrics
var (
// Histogram to track duration of container operations
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
Buckets: []float64{0.1, 0.25, 0.5, 0.75, 1, 2, 3, 5, 7.5, 10, 15, 30, 60, 120, 300},
},
[]string{"operation"},
)
// Counter to track occurrence of container operations with status
ContainerOperationCount = metric.NewCounterVec(
metric.CounterOpts{
Name: "container_operation_total",
Help: "Total number of container operations",
},
[]string{"operation", "status"},
)
)