metrics

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Cluster metrics
	NodesTotal = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "warren_nodes_total",
			Help: "Total number of nodes by role and status",
		},
		[]string{"role", "status"},
	)

	ServicesTotal = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_services_total",
			Help: "Total number of services",
		},
	)

	TasksTotal = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "warren_tasks_total",
			Help: "Total number of tasks by state",
		},
		[]string{"state"},
	)

	SecretsTotal = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_secrets_total",
			Help: "Total number of secrets",
		},
	)

	VolumesTotal = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_volumes_total",
			Help: "Total number of volumes",
		},
	)

	// Raft metrics
	RaftLeader = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_raft_is_leader",
			Help: "Whether this node is the Raft leader (1 = leader, 0 = follower)",
		},
	)

	RaftPeers = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_raft_peers_total",
			Help: "Total number of Raft peers in the cluster",
		},
	)

	RaftLogIndex = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_raft_log_index",
			Help: "Current Raft log index",
		},
	)

	RaftAppliedIndex = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "warren_raft_applied_index",
			Help: "Last applied Raft log index",
		},
	)

	// API metrics
	APIRequestsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "warren_api_requests_total",
			Help: "Total number of API requests by method and status",
		},
		[]string{"method", "status"},
	)

	APIRequestDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "warren_api_request_duration_seconds",
			Help:    "API request duration in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"method"},
	)

	// Scheduler metrics
	SchedulingLatency = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "warren_scheduling_latency_seconds",
			Help:    "Time taken to schedule tasks in seconds",
			Buckets: prometheus.DefBuckets,
		},
	)

	TasksScheduled = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "warren_tasks_scheduled_total",
			Help: "Total number of tasks scheduled",
		},
	)

	TasksFailed = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "warren_tasks_failed_total",
			Help: "Total number of failed tasks",
		},
	)
)

Functions

func Handler

func Handler() http.Handler

Handler returns the Prometheus HTTP handler

Types

type Collector

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

Collector collects metrics from the manager

func NewCollector

func NewCollector(mgr *manager.Manager) *Collector

NewCollector creates a new metrics collector

func (*Collector) Start

func (c *Collector) Start()

Start begins collecting metrics

func (*Collector) Stop

func (c *Collector) Stop()

Stop stops the collector

Jump to

Keyboard shortcuts

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