metrics

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace is the prefix for all metrics.
	Namespace = "heimdallv2"
)

Variables

View Source
var (
	// PreBlockerDuration tracks the time taken by the PreBlocker function.
	PreBlockerDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "pre_blocker_duration_seconds",
			Help:      "Time taken by PreBlocker function in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// BeginBlockerDuration tracks the time taken by the BeginBlocker function.
	BeginBlockerDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "begin_blocker_duration_seconds",
			Help:      "Time taken by BeginBlocker function in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// EndBlockerDuration tracks the time taken by the EndBlocker function.
	EndBlockerDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "end_blocker_duration_seconds",
			Help:      "Time taken by EndBlocker function in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// PrepareProposalDuration tracks the time taken by the PrepareProposal handler.
	PrepareProposalDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "prepare_proposal_duration_seconds",
			Help:      "Time taken by PrepareProposal handler in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// ProcessProposalDuration tracks the time taken by the ProcessProposal handler.
	ProcessProposalDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "process_proposal_duration_seconds",
			Help:      "Time taken by ProcessProposal handler in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// ExtendVoteDuration tracks the time taken by ExtendVote handler.
	ExtendVoteDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "extend_vote_duration_seconds",
			Help:      "Time taken by ExtendVote handler in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// VerifyVoteExtensionDuration tracks the time taken by VerifyVoteExtension handler.
	VerifyVoteExtensionDuration = promauto.NewSummary(
		prometheus.SummaryOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "verify_vote_extension_duration_seconds",
			Help:      "Time taken by VerifyVoteExtension handler in seconds",
			Objectives: map[float64]float64{
				0.50: 0.05,
				0.90: 0.01,
				0.99: 0.001,
			},
		},
	)

	// ExtendVoteBudgetExhaustedTotal counts ExtendVote handler turns where the
	// Zurich budget was exhausted before completion. Labels: phase = "side_tx_loop"
	// (truncated mid-side-tx iteration) or "pre_milestone" (skipped milestone
	// proposition entirely). This can be used to tune extendVoteBudget
	// against real Bor RPC tail latency.
	ExtendVoteBudgetExhaustedTotal = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: Namespace,
			Subsystem: "abci",
			Name:      "extend_vote_budget_exhausted_total",
			Help:      "Number of ExtendVote turns where the Zurich budget was exhausted before completion, labeled by phase",
		},
		[]string{"phase"},
	)
)
View Source
var (
	BorFailoverSwitches = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: "bor_failover",
		Name:      "switches_total",
		Help:      "Total in-call failover switches of the active Bor endpoint, by transport",
	}, []string{"transport"})

	BorFailoverProactiveSwitches = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: "bor_failover",
		Name:      "proactive_switches_total",
		Help:      "Total background-prober switches of the active Bor endpoint (including revert-to-primary), by transport",
	}, []string{"transport"})

	BorFailoverActiveIndex = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: Namespace,
		Subsystem: "bor_failover",
		Name:      "active_index",
		Help:      "Index of the currently active Bor endpoint (0 = primary), by transport",
	}, []string{"transport"})

	BorFailoverHealthyEndpoints = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: Namespace,
		Subsystem: "bor_failover",
		Name:      "healthy_endpoints",
		Help:      "Number of Bor endpoints currently considered healthy, by transport",
	}, []string{"transport"})
)

Bor endpoint-failover metrics. Labeled by transport ("http" or "grpc") so a single dashboard shows failover behavior across both Bor client paths. Counter names use the _total suffix per Prometheus convention.

View Source
var (
	// SelfHealStakeEventsProcessed counts missing nonce-gated stake events
	// (StakeUpdate, SignerChange, UnstakeInit) successfully recovered.
	SelfHealStakeEventsProcessed = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: "self_healing",
		Name:      "stake_events_processed_total",
		Help:      "Total number of missing nonce-gated stake events (StakeUpdate, SignerChange, UnstakeInit) processed by the self-heal loop",
	})

	// SelfHealStateSyncsProcessed counts missing StateSynced events
	// successfully recovered.
	SelfHealStateSyncsProcessed = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: "self_healing",
		Name:      "state_syncs_processed_total",
		Help:      "Total number of missing StateSynced events processed by the self-heal loop",
	})

	// SelfHealCheckpointAcksProcessed counts missing NewHeaderBlock checkpoint
	// acks successfully queued for replay.
	SelfHealCheckpointAcksProcessed = promauto.NewCounter(prometheus.CounterOpts{
		Namespace: Namespace,
		Subsystem: "self_healing",
		Name:      "checkpoint_acks_processed_total",
		Help:      "Total number of missing NewHeaderBlock checkpoint ACKs queued by the self-heal loop",
	})
)

Self-healing counters track recovery events processed by the bridge listener's self-heal loop. Names follow the heimdallv2 metrics namespace and the Prometheus convention (snake_case + _total suffix for monotonic counters), so they're discoverable by standard Prometheus tooling and Datadog scrapers.

Functions

func BorFailover added in v0.9.0

func BorFailover(transport string) failover.Metrics

BorFailover wires the failover state machine's metric hooks to the labeled Prometheus vectors for the given transport ("http" or "grpc").

func InitMetrics

func InitMetrics()

func RecordABCIHandlerDuration added in v0.3.0

func RecordABCIHandlerDuration(metric prometheus.Summary, start time.Time)

RecordABCIHandlerDuration records the time taken for any ABCI handler.

func RecordExtendVoteBudgetExhausted added in v0.9.0

func RecordExtendVoteBudgetExhausted(phase string)

RecordExtendVoteBudgetExhausted increments the budget-exhaustion counter for the given phase.

func UpdateHeimdallV2Info

func UpdateHeimdallV2Info(version, commit string)

UpdateHeimdallV2Info updates the heimdallv2_info metric with the current version and commit details.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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