metrics

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMetricsAddress           = ":8081"
	DefaultMinerSetMetricsAddress   = ":8082"
	DefaultMinerMetricsAddress      = ":8083"
	DefaultNodeServerMetricsAddress = ":8084"
)

Variables

View Source
var (
	// https://github.com/go-kratos/examples/tree/main/metrics
	KratosMetricSeconds = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "server",
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "server requests duration(ms).",
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	}, []string{"kind", "operation"})

	KratosServerMetricRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: "client",
		Subsystem: "requests",
		Name:      "code_total",
		Help:      "The total number of processed requests",
	}, []string{"kind", "operation", "code", "reason"})
)
View Source
var (
	// MinerCountDesc is a metric about miner object count in the cluster.
	MinerCountDesc = prometheus.NewDesc("napi_miner_items", "Count of miner objects currently at the apiserver", nil, nil)
	// MinerSetCountDesc Count of minerset object count at the apiserver.
	MinerSetCountDesc = prometheus.NewDesc("napi_minerset_items", "Count of minersets at the apiserver", nil, nil)
	// MinerInfoDesc is a metric about miner object info in the cluster.
	MinerInfoDesc = prometheus.NewDesc("napi_miner_created_timestamp_seconds", "Timestamp of the napi managed Miner creation time", []string{"name", "namespace", "spec_provider_id", "node", "api_version", "phase"}, nil)
	// MinerSetInfoDesc is a metric about miner object info in the cluster.
	MinerSetInfoDesc = prometheus.NewDesc("napi_minerset_created_timestamp_seconds", "Timestamp of the napi managed Minerset creation time", []string{"name", "namespace", "api_version"}, nil)

	// MinerSetStatusAvailableReplicasDesc is the information of the Minerset's status for available replicas.
	MinerSetStatusAvailableReplicasDesc = prometheus.NewDesc("napi_miner_set_status_replicas_available", "Information of the napi managed Minerset's status for available replicas", []string{"name", "namespace"}, nil)

	// MinerSetStatusReadyReplicasDesc is the information of the Minerset's status for ready replicas.
	MinerSetStatusReadyReplicasDesc = prometheus.NewDesc("napi_miner_set_status_replicas_ready", "Information of the napi managed Minerset's status for ready replicas", []string{"name", "namespace"}, nil)

	// MinerSetStatusReplicasDesc is the information of the Minerset's status for replicas.
	MinerSetStatusReplicasDesc = prometheus.NewDesc("napi_miner_set_status_replicas", "Information of the napi managed Minerset's status for replicas", []string{"name", "namespace"}, nil)

	// MinerCollectorUp is a Prometheus metric, which reports reflects successful collection and reporting of all the metrics.
	MinerCollectorUp = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "napi_mao_collector_up",
		Help: "Node API Controller metrics are being collected and reported successfully",
	}, []string{"kind"})
)
View Source
var (
	// MinerPhaseTransitionSeconds is a metric to capute the time between a Miner being created and entering a particular phase.
	MinerPhaseTransitionSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "napi_miner_phase_transition_seconds",
			Help:    "Number of seconds between Miner creation and Miner transition to a phase.",
			Buckets: []float64{5, 10, 20, 30, 60, 90, 120, 180, 240, 300, 360, 480, 600},
		}, []string{"phase"},
	)
)

Metrics for use in the Miner controller.

Functions

func RegisterFailedInstanceCreate

func RegisterFailedInstanceCreate(labels *MinerLabels)

func RegisterFailedInstanceDelete

func RegisterFailedInstanceDelete(labels *MinerLabels)

func RegisterFailedInstanceUpdate

func RegisterFailedInstanceUpdate(labels *MinerLabels)

Types

type MinerCollector

type MinerCollector struct {
	// contains filtered or unexported fields
}

MinerCollector is implementing prometheus.Collector interface.

func NewMinerCollector

func NewMinerCollector(client client.Client, namespace string) *MinerCollector

func (*MinerCollector) Collect

func (mc *MinerCollector) Collect(ch chan<- prometheus.Metric)

Collect is method required to implement the prometheus.Collector(prometheus/client_golang/prometheus/collector.go) interface.

func (MinerCollector) Describe

func (mc MinerCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

type MinerLabels

type MinerLabels struct {
	Name      string
	Namespace string
	Reason    string
}

MinerLabels is the group of labels that are applied to the miner metrics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL