monitoring

package
v0.0.0-...-a779712 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressRequiresToken

func AddressRequiresToken(addr string) bool

AddressRequiresToken reports whether the address is exposed beyond loopback and therefore requires bearer-token protection.

func MetricsServeTask

func MetricsServeTask(server *http.Server, listener net.Listener, address string) func() error

MetricsServeTask returns an errgroup task that serves the metrics endpoint until shutdown.

func MetricsShutdownTask

func MetricsShutdownTask(ctx context.Context, server *http.Server, address string) func() error

MetricsShutdownTask returns an errgroup task that stops the metrics server on context cancellation.

func NewMetricsServer

func NewMetricsServer(handler http.Handler, bearerToken string) *http.Server

NewMetricsServer constructs an HTTP server for the protected metrics handler.

func NewPprofHandler

func NewPprofHandler() http.Handler

NewPprofHandler returns an http.Handler that serves the Go runtime profiling endpoints under /debug/pprof/.

func NewPprofServer

func NewPprofServer(bearerToken string) *http.Server

NewPprofServer creates an HTTP server for the pprof debug endpoints, optionally protected by bearer-token authentication.

func PprofServeTask

func PprofServeTask(server *http.Server, listener net.Listener, address string) func() error

PprofServeTask returns an errgroup task that serves the pprof endpoint until shutdown.

func PprofShutdownTask

func PprofShutdownTask(ctx context.Context, server *http.Server, address string) func() error

PprofShutdownTask returns an errgroup task that stops the pprof server on context cancellation.

func ProtectHandler

func ProtectHandler(handler http.Handler, bearerToken string) http.Handler

ProtectHandler wraps a metrics handler with optional bearer-token authentication.

Types

type DynamoDBMetrics

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

func (*DynamoDBMetrics) ObserveDynamoDBRequest

func (m *DynamoDBMetrics) ObserveDynamoDBRequest(report DynamoDBRequestReport)

ObserveDynamoDBRequest records the final outcome of a request.

func (*DynamoDBMetrics) ObserveInFlightChange

func (m *DynamoDBMetrics) ObserveInFlightChange(operation string, delta float64)

ObserveInFlightChange adjusts the in-flight request gauge for an operation.

type DynamoDBRequestObserver

type DynamoDBRequestObserver interface {
	ObserveInFlightChange(operation string, delta float64)
	ObserveDynamoDBRequest(report DynamoDBRequestReport)
}

DynamoDBRequestObserver records per-request DynamoDB-compatible API metrics.

type DynamoDBRequestReport

type DynamoDBRequestReport struct {
	Operation     string
	HTTPStatus    int
	ErrorType     string
	Duration      time.Duration
	RequestBytes  int
	ResponseBytes int
	Tables        []string
	TableMetrics  map[string]DynamoDBTableMetrics
}

DynamoDBRequestReport is the normalized result of a single request.

type DynamoDBTableMetrics

type DynamoDBTableMetrics struct {
	ReturnedItems int
	ScannedItems  int
	WrittenItems  int
}

DynamoDBTableMetrics captures table-scoped work done by a request.

type RaftMetrics

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

RaftMetrics holds all Prometheus gauge vectors for a single Raft group. Fields are populated by observeRuntime from raft.Raft.Stats().

type RaftObserver

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

func (*RaftObserver) ObserveOnce

func (o *RaftObserver) ObserveOnce(runtimes []RaftRuntime)

ObserveOnce captures the latest raft state for all configured runtimes.

func (*RaftObserver) Start

func (o *RaftObserver) Start(ctx context.Context, runtimes []RaftRuntime, interval time.Duration)

Start polls raft state and configuration on a fixed interval until ctx is canceled.

type RaftRuntime

type RaftRuntime struct {
	GroupID uint64
	Raft    *raft.Raft
}

RaftRuntime describes a raft group observed by the metrics exporter.

type Registry

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

Registry owns the Prometheus registry used by a single Elastickv node.

func NewRegistry

func NewRegistry(nodeID string, nodeAddress string) *Registry

NewRegistry builds a registry with constant labels that identify the local node.

func (*Registry) DynamoDBObserver

func (r *Registry) DynamoDBObserver() DynamoDBRequestObserver

DynamoDBObserver returns the DynamoDB request observer backed by this registry.

func (*Registry) Gatherer

func (r *Registry) Gatherer() prometheus.Gatherer

Gatherer exposes the underlying gatherer for tests and custom exporters.

func (*Registry) Handler

func (r *Registry) Handler() http.Handler

Handler returns an HTTP handler that exposes the Prometheus scrape endpoint.

func (*Registry) RaftObserver

func (r *Registry) RaftObserver() *RaftObserver

RaftObserver returns the Raft topology observer backed by this registry.

Jump to

Keyboard shortcuts

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