metrics

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

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

Metrics holds Prometheus counters and histograms for the engine.

func New

func New() *Metrics

New creates and registers a Metrics instance on an isolated registry, preventing double-registration panics when multiple instances are created (e.g. in tests).

func Noop

func Noop() *Metrics

Noop returns a Metrics instance that does nothing (used when metrics disabled).

func (*Metrics) Record

func (m *Metrics) Record(r task.Result)

Record observes the result of a completed task.

func (*Metrics) ServeHTTP

func (m *Metrics) ServeHTTP(ctx context.Context, bindAddress string, port int)

ServeHTTP starts the Prometheus metrics HTTP endpoint and shuts it down gracefully when ctx is cancelled. Call in a goroutine.

Routes:

  • /metrics — Prometheus scrape endpoint
  • /healthz — liveness probe; always returns 200 {"status":"ok"}

Jump to

Keyboard shortcuts

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