telemetry

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthMintResultSuccess      = "success"
	AuthMintResultUnknownKey   = "unknown_key"   // 401 from mint endpoint
	AuthMintResultRevoked      = "revoked"       // 403 key_revoked
	AuthMintResultSuspended    = "suspended"     // 403 key_suspended
	AuthMintResultForbidden    = "forbidden"     // other 403
	AuthMintResultBadStatus    = "bad_status"    // non-2xx, non-401/403
	AuthMintResultNetworkError = "network_error" // POST failed before a status was read
	AuthMintResultEmptyToken   = "empty_token"   // 2xx but body missing access_token
	AuthMintResultVerifyFailed = "verify_failed" // minted token failed local JWKS verify
	// AuthMintResultAssertionFailed is a local failure to sign the client assertion
	// (enrollment mode only): the request never left the process.
	AuthMintResultAssertionFailed = "assertion_failed"
)

Result label values for auth_token_mint_total.

View Source
const (
	EnrollmentResultSuccess = "success" // enrolled and persisted a new credential
	EnrollmentResultReused  = "reused"  // loaded an existing credential from disk
)

Result label values for auth_enrollment_total. "reused" is the steady state; repeated "success" across a fleet means credential directories are not persisting.

View Source
const (
	ClusterClaimAuthorized = "authorized" // cluster_ids present and a member
	ClusterClaimRejected   = "rejected"   // cluster_ids missing or not a member
)

Result label values for p2p_handshake_cluster_claim_total: the outcome of the cluster-binding check at the mumP2P handshake (#707).

Variables

View Source
var (
	CustomRegistry *prometheus.Registry
)
View Source
var HTTPMetricsGatherer prometheus.Gatherer = prometheus.GathererFunc(func() ([]*dto.MetricFamily, error) {
	return MetricsGatherer().Gather()
})

HTTPMetricsGatherer re-resolves MetricsGatherer on each scrape so async remote-write metrics are included.

Functions

func AddDuplicateShardCount

func AddDuplicateShardCount()

func AddTotalShardCount

func AddTotalShardCount()

Shard helpers

func AddUnhelpfulShardCount

func AddUnhelpfulShardCount()

func AddUnnecessaryShardCount

func AddUnnecessaryShardCount()

func CLPeerConnected

func CLPeerConnected()

func CLPeerDisconnected

func CLPeerDisconnected()

func CLTotalMessagesInc

func CLTotalMessagesInc(topic string)

func DecStreamConnections

func DecStreamConnections()

DecStreamConnections marks a consumer connection as closed.

func GetBadMessagesToCL

func GetBadMessagesToCL() uint64

func GetBadMessagesToMum

func GetBadMessagesToMum() uint64

func GetCLSSZErrors

func GetCLSSZErrors() map[string]uint64

func GetMumSSZErrors

func GetMumSSZErrors() map[string]uint64

func HealthCL

func HealthCL() int64

func HealthMUM

func HealthMUM() int64

func IncAccelerateDecision added in v1.2.1

func IncAccelerateDecision(result string)

func IncAggregationMessage

func IncAggregationMessage(direction string, sizeBytes int)

func IncAttestationDropped

func IncAttestationDropped(reason string)

func IncAttestationEvaluated

func IncAttestationEvaluated()

func IncAttestationForwarded

func IncAttestationForwarded()

func IncAttestationPack

func IncAttestationPack(count int)

func IncAttestationPackError

func IncAttestationPackError()

func IncAttestationSubnet

func IncAttestationSubnet(subnetIndex uint32)

func IncAuthMintResult

func IncAuthMintResult(result string)

func IncBlocksFirstSeen

func IncBlocksFirstSeen(source entities.Source)

func IncClusterClaimResult

func IncClusterClaimResult(result string)

func IncEnrollmentResult added in v1.3.1

func IncEnrollmentResult(result string)

func IncParseSSZError

func IncParseSSZError(topic string, source entities.Source)

func IncStreamConnections

func IncStreamConnections()

IncStreamConnections marks a consumer connection as opened.

func IncreaseAggregationIncluded

func IncreaseAggregationIncluded(topic string, val int)

func IncreaseBadMessages

func IncreaseBadMessages(source entities.Source)

func IncreaseBadMessagesToCL

func IncreaseBadMessagesToCL()

func IncreaseBadMessagesToMum

func IncreaseBadMessagesToMum()

func InitMetrics

func InitMetrics(ctx context.Context, log logger.AppLogger, cfg *config.AppConfig) <-chan struct{}

InitMetrics initializes the metrics registry. namespace and subsystem are taken directly from cfg — defaults are defined in AppConfig (OPT_TELEMETRY_NAMESPACE / OPT_TELEMETRY_SUBSYSTEM). It returns a done channel that is closed once the Mimir remote-write goroutine has completed its final flush (nil when RemotePushEnable is false).

func InitMetricsWithRegistry

func InitMetricsWithRegistry(log logger.AppLogger, pairedWith string)

InitMetricsWithRegistry initializes and registers all gateway metric collectors and enables metrics collection. pairedWith labels the app build-info metric with this gateway's type.

func LibP2PGossipsubRPCMessagesInc

func LibP2PGossipsubRPCMessagesInc(topic, pid, direction string)

func MetricsEnabled

func MetricsEnabled() bool

func MetricsGatherer

func MetricsGatherer() prometheus.Gatherer

MetricsGatherer returns the gatherer used for /metrics, including remote-write when active.

func MumP2PPeerConnected

func MumP2PPeerConnected()

func MumP2PPeerDisconnected

func MumP2PPeerDisconnected()

func MumP2PTotalMessagesInc

func MumP2PTotalMessagesInc(topic string)

func ObserveAttestationInclusionDelay

func ObserveAttestationInclusionDelay(slotDelta uint64)

func ObserveAttestationPackItems

func ObserveAttestationPackItems(items int)

func ObserveAttestationPackLatency

func ObserveAttestationPackLatency(ms float64)

func ObserveAttestationPackSize

func ObserveAttestationPackSize(sizeBytes int)

func ObserveAttestationPackUniqueDataKeys

func ObserveAttestationPackUniqueDataKeys(keys int)

func ObserveAttestationPropagationLatency

func ObserveAttestationPropagationLatency(ms float64)

func ObserveLibP2PArrivalLatency

func ObserveLibP2PArrivalLatency(ms int64)

func ObserveMumP2PArrivalLatency

func ObserveMumP2PArrivalLatency(ms int64)

func RecordBlockPathArrival

func RecordBlockPathArrival(mumP2P bool, recvAt, slotStartMs int64, originGatewayID, upstreamPeerID string)

RecordBlockPathArrival records hop counters and slot-relative arrival for one beacon block path.

func RecordCLMessageAt

func RecordCLMessageAt()

func RecordLibP2PHopInfo

func RecordLibP2PHopInfo(ethUpstreamPeerID string)

RecordLibP2PHopInfo increments the total libp2p upstream message counter.

func RecordMumMessageAt

func RecordMumMessageAt()

func RecordMumP2PHopInfo

func RecordMumP2PHopInfo(originGatewayID, upstreamPeerID string)

RecordMumP2PHopInfo increments the total mump2p upstream/origin message counters.

func RecordProcessingTime

func RecordProcessingTime(process string, duration time.Duration)

func RecordStreamAuthFailure

func RecordStreamAuthFailure()

RecordStreamAuthFailure counts one rejected consumer connection.

func RecordStreamEventDropped

func RecordStreamEventDropped()

RecordStreamEventDropped counts one dropped consumer event.

func RecordStreamEventSent

func RecordStreamEventSent()

RecordStreamEventSent counts one consumer event written to a connection.

func RecordStreamHeartbeatSent added in v1.3.0

func RecordStreamHeartbeatSent()

RecordStreamHeartbeatSent counts one liveness frame.

func RecordStreamReauthFailure added in v1.3.0

func RecordStreamReauthFailure()

RecordStreamReauthFailure counts one failed re-verification. In observe mode this is the only signal that a consumer would have been cut.

func ResetCLPeersPerTopic

func ResetCLPeersPerTopic()

func ResetMumP2PPeersPerTopic

func ResetMumP2PPeersPerTopic()

func SetAccelerateWindow added in v1.2.1

func SetAccelerateWindow(toSlot uint64, generatedAtMs int64)

func SetAppBuildPairedWith added in v1.3.3

func SetAppBuildPairedWith(pairedWith string)

SetAppBuildPairedWith moves the app_build_info series to the current gateway type. No-op before InitMetricsWithRegistry, and when the type is unchanged.

func SetAuthTokenExpiresAt

func SetAuthTokenExpiresAt(expiresAtUnix int64)

func SetCLMeshPeers

func SetCLMeshPeers(topicPeerIDs map[string][]string)

func SetCLPeers

func SetCLPeers(count int)

func SetCLPeersPerTopic

func SetCLPeersPerTopic(topic string, count int)

func SetKnownValidatorsTotal

func SetKnownValidatorsTotal(count int)

func SetLastBlockReceivedTimestamp

func SetLastBlockReceivedTimestamp(unixSec float64)

func SetMumP2PMeshPeers

func SetMumP2PMeshPeers(topicPeerIDs map[string][]string)

func SetMumP2PPeers

func SetMumP2PPeers(count int)

func SetMumP2PPeersPerTopic

func SetMumP2PPeersPerTopic(topic string, count int)

func SetP2PActiveTopics

func SetP2PActiveTopics(count int)

func SetPropagationState

func SetPropagationState(enabled bool)

func SetPushToken

func SetPushToken(token string)

SetPushToken installs the bearer token used by subsequent mimir/loki pushes.

func SetStreamOldestConnectionStart added in v1.3.0

func SetStreamOldestConnectionStart(unixSeconds float64)

SetStreamOldestConnectionStart publishes when the longest-running consumer connection opened. A timestamp rather than an age so the value stays correct between scrapes; query it as time() - <this>. Zero means nothing is connected. It bounds how long a connection has been trusted on the strength of a single subscribe-time authentication.

func TraceMesh

func TraceMesh(event, topic string)

TraceMesh records a mesh-topology event, optionally scoped to a topic (empty for peer add/remove).

func TraceMessage

func TraceMessage(event, topic string)

TraceMessage records a message-lifecycle event (publish|deliver|duplicate|reject) on a topic.

func TraceMessageReject

func TraceMessageReject(topic, reason string)

TraceMessageReject records a rejected message with its validation reason.

func TraceRPC

func TraceRPC(direction string, bytes uint64)

TraceRPC records an RPC event and the bytes it carried (0 for drop, which has no length).

func TraceShard

func TraceShard(kind string, coefficientBytes int)

TraceShard records an RLNC shard event and its coefficient byte size.

Types

type BandwidthCollector

type BandwidthCollector struct{}

func NewBandwidthCollector

func NewBandwidthCollector() *BandwidthCollector

func (*BandwidthCollector) GetBandwidthByPeer

func (b *BandwidthCollector) GetBandwidthByPeer() map[peer.ID]metrics.Stats

func (*BandwidthCollector) GetBandwidthByProtocol

func (b *BandwidthCollector) GetBandwidthByProtocol() map[protocol.ID]metrics.Stats

func (*BandwidthCollector) GetBandwidthForPeer

func (b *BandwidthCollector) GetBandwidthForPeer(peer.ID) metrics.Stats

func (*BandwidthCollector) GetBandwidthForProtocol

func (b *BandwidthCollector) GetBandwidthForProtocol(protocol.ID) metrics.Stats

func (*BandwidthCollector) GetBandwidthTotals

func (b *BandwidthCollector) GetBandwidthTotals() metrics.Stats

func (*BandwidthCollector) LogRecvMessage

func (b *BandwidthCollector) LogRecvMessage(int64)

func (*BandwidthCollector) LogRecvMessageStream

func (b *BandwidthCollector) LogRecvMessageStream(size int64, proto protocol.ID, _ peer.ID)

LogRecvMessageStream logs the size of a received message stream along with its protocol and peer ID.

func (*BandwidthCollector) LogSentMessage

func (b *BandwidthCollector) LogSentMessage(int64)

func (*BandwidthCollector) LogSentMessageStream

func (b *BandwidthCollector) LogSentMessageStream(size int64, proto protocol.ID, _ peer.ID)

LogSentMessageStream logs the size of a sent message stream along with its protocol and peer ID.

func (*BandwidthCollector) Reset

func (b *BandwidthCollector) Reset()

func (*BandwidthCollector) TrimIdle

func (b *BandwidthCollector) TrimIdle(time.Time)

type ConnectionsMeter

type ConnectionsMeter struct{}

ConnectionsMeter implements network.Notifiee for connection counts. Stream metrics come from libp2p.PrometheusRegisterer (libp2p_rcmgr_streams).

func NewConnectionsMeter

func NewConnectionsMeter() *ConnectionsMeter

NewConnectionsMeter creates a new ConnectionsMeter instance.

func (*ConnectionsMeter) Connected

func (c *ConnectionsMeter) Connected(_ network.Network, conn network.Conn)

func (*ConnectionsMeter) Disconnected

func (c *ConnectionsMeter) Disconnected(_ network.Network, conn network.Conn)

func (*ConnectionsMeter) Listen

func (*ConnectionsMeter) ListenClose

func (c *ConnectionsMeter) ListenClose(network.Network, ma.Multiaddr)

type LokiWriter

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

func NewLokiWriter

func NewLokiWriter(cfg *config.AppConfig, operatorID string, log logger.AppLogger) *LokiWriter

NewLokiWriter creates a LokiWriter. Call Start to begin flushing.

func (*LokiWriter) Start

func (w *LokiWriter) Start(ctx context.Context) <-chan struct{}

Start launches the background flush goroutine. The returned channel is closed once the final flush has completed so callers can wait for clean shutdown.

func (*LokiWriter) Write

func (w *LokiWriter) Write(p []byte) (int, error)

Write implements io.Writer. It enqueues the log line non-blocking.

type MumP2PCollector

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

MumP2PCollector implements pubsub.RawTracer for Optimum's mump2p pubsub.

func NewMumP2PCollector

func NewMumP2PCollector() *MumP2PCollector

func (*MumP2PCollector) AddPeer

func (g *MumP2PCollector) AddPeer(id peer.ID, protoID protocol.ID)

func (*MumP2PCollector) DeliverMessage

func (g *MumP2PCollector) DeliverMessage(msg *pubsub.Message)

func (*MumP2PCollector) DropRPC

func (g *MumP2PCollector) DropRPC(*pubsub.RPC, peer.ID)

func (*MumP2PCollector) DuplicateMessage

func (g *MumP2PCollector) DuplicateMessage(msg *pubsub.Message)

func (*MumP2PCollector) Graft

func (g *MumP2PCollector) Graft(peer.ID, string)

func (*MumP2PCollector) Join

func (g *MumP2PCollector) Join(string)

func (*MumP2PCollector) Leave

func (g *MumP2PCollector) Leave(string)

func (*MumP2PCollector) Prune

func (g *MumP2PCollector) Prune(peer.ID, string)

func (*MumP2PCollector) RecvRPC

func (g *MumP2PCollector) RecvRPC(*pubsub.RPC)

func (*MumP2PCollector) RejectMessage

func (g *MumP2PCollector) RejectMessage(msg *pubsub.Message, reason string)

func (*MumP2PCollector) RemovePeer

func (g *MumP2PCollector) RemovePeer(id peer.ID)

func (*MumP2PCollector) SendRPC

func (g *MumP2PCollector) SendRPC(*pubsub.RPC, peer.ID)

func (*MumP2PCollector) ThrottlePeer

func (g *MumP2PCollector) ThrottlePeer(peer.ID)

func (*MumP2PCollector) UndeliverableMessage

func (g *MumP2PCollector) UndeliverableMessage(*pubsub.Message)

func (*MumP2PCollector) ValidateMessage

func (g *MumP2PCollector) ValidateMessage(msg *pubsub.Message)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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