prometheus

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package prometheus provides Prometheus metrics for asyncmachine. Metrics are collected from machine's transitions and states.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindToPusher added in v0.8.0

func BindToPusher(metrics *Metrics, pusher *push.Pusher)

func BindToRegistry added in v0.8.0

func BindToRegistry(metrics *Metrics, registry *prometheus.Registry)

Types

type Metrics

type Metrics struct {
	// Tracer is a Prometheus tracer for the machine. You can detach it any time
	// using Machine.DetachTracer.
	Tracer am.Tracer

	// number of registered states
	StatesAmount prometheus.Gauge

	// number of relations for all registered states
	RelAmount prometheus.Gauge

	// number of state referenced by relations for all registered states
	RefStatesAmount prometheus.Gauge

	// current number of queued transitions (per transition)
	QueueSize prometheus.Gauge

	// transition duration in machine's clock (ticks per tx)
	TxTick prometheus.Gauge

	// number of active states (per transition)
	StatesActiveAmount prometheus.Gauge

	// number of inactive states (per transition)
	StatesInactiveAmount prometheus.Gauge

	// number of states added (per transition)
	StatesAdded prometheus.Gauge

	// number of states removed (per transition)
	StatesRemoved prometheus.Gauge

	// number of states touched (per transition)
	StatesTouched prometheus.Gauge

	// number of errors
	ExceptionsCount prometheus.Gauge

	// number of transitions
	TransitionsCount prometheus.Gauge

	// steps per transition
	StepsAmount prometheus.Gauge

	// amount of executed handlers per tx
	HandlersAmount prometheus.Gauge

	// transition time
	TxTime prometheus.Gauge
	// contains filtered or unexported fields
}

Metrics is a set of Prometheus metrics for asyncmachine.

func BindMach added in v0.8.0

func BindMach(mach am.Api) *Metrics

BindMach bind transitions to Prometheus metrics.

func (*Metrics) Close

func (m *Metrics) Close()

Close sets all gauges to 0.

func (*Metrics) Sync added in v0.8.0

func (m *Metrics) Sync()

Sync synchronizes the metrics with the current counters, averaging certain values and using totals of others. After that the counters are reset to 0.

Sync should be called right before pushing or scraping.

type PromTracer added in v0.8.0

type PromTracer struct {
	*am.NoOpTracer
	// contains filtered or unexported fields
}

PromTracer is am.Tracer for tracing state machines.

func (*PromTracer) MachineDispose added in v0.8.0

func (t *PromTracer) MachineDispose(machId string)

func (*PromTracer) StructChange added in v0.8.0

func (t *PromTracer) StructChange(machine am.Api, old am.Struct)

func (*PromTracer) TransitionEnd added in v0.8.0

func (t *PromTracer) TransitionEnd(tx *am.Transition)

func (*PromTracer) TransitionInit added in v0.8.0

func (t *PromTracer) TransitionInit(tx *am.Transition)

Jump to

Keyboard shortcuts

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