metrics

package
v0.18.49 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus instrumentation for Wadjet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Registry *prometheus.Registry
	// Query metrics
	QueriesTotal     *prometheus.CounterVec
	QueryDuration    *prometheus.HistogramVec
	QueryRowsScanned *prometheus.CounterVec
	QueryBytesRead   prometheus.Counter
	ActiveQueries    prometheus.Gauge

	// Scanner metrics
	FilesScanned      prometheus.Counter
	FilesPruned       prometheus.Counter
	RowGroupsScanned  prometheus.Counter
	RowGroupsPruned   prometheus.Counter
	PartitionsScanned prometheus.Counter
	PartitionsPruned  prometheus.Counter

	// Worker metrics
	WorkerTasks        *prometheus.CounterVec
	WorkerTaskDuration *prometheus.HistogramVec
	WorkerActive       prometheus.Gauge
	WorkerMemory       prometheus.Gauge

	// Coordinator metrics
	RegisteredWorkers prometheus.Gauge

	// Pipeline metrics
	BatchesProcessed prometheus.Counter
	RowsOutput       prometheus.Counter

	// Memory/Spill metrics
	SpillEvents       prometheus.Counter
	SpillBytesWritten prometheus.Counter
	MemoryBudgetBytes prometheus.Gauge
	MemoryUsedBytes   prometheus.Gauge

	// Cache metrics
	CacheHits   prometheus.Counter
	CacheMisses prometheus.Counter
	CacheBytes  prometheus.Gauge

	// Object-store circuit breaker. Labelled by operation class (read /
	// write / delete) because the classes are independent breakers: an
	// operator needs to see that DELETEs are tripping without concluding
	// that reads are (ADR-0028).
	CircuitBreakerOpened *prometheus.CounterVec
}

Metrics holds all Prometheus metrics for a Wadjet node. Uses a custom registry to avoid conflicts with the global default.

func New

func New() *Metrics

New creates and registers all Prometheus metrics with a custom registry.

func (*Metrics) Handler

func (m *Metrics) Handler() http.Handler

Handler returns an HTTP handler for the /metrics endpoint using the custom registry.

func (*Metrics) QueryTimer

func (m *Metrics) QueryTimer(queryType string) func()

QueryTimer returns a function that records query duration when called.

func (*Metrics) TaskTimer

func (m *Metrics) TaskTimer(taskType string) func(success bool)

TaskTimer returns a function that records task duration when called.

Jump to

Keyboard shortcuts

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