Documentation
¶
Index ¶
Constants ¶
const ( // MetricNamespace is the common namespace for all Nitronode metrics. // Renamed from "clearnode" in v1.3.0 — Prometheus alerts and Grafana // dashboards must be updated to reference nitronode_* metric names. MetricNamespace = "nitronode" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionResult ¶
type ActionResult string
const ( ActionResultSuccess ActionResult = "success" ActionResultFailed ActionResult = "failed" )
func (ActionResult) String ¶
func (res ActionResult) String() string
type RuntimeMetricExporter ¶
type RuntimeMetricExporter interface {
// Shared
IncUserState(asset string, homeBlockchainID uint64, transition core.TransitionType, applicationID string)
RecordTransaction(asset string, txType core.TransactionType, amount decimal.Decimal, applicationID string)
IncChannelStateSigValidation(sigType core.ChannelSignerType, success bool)
IncChannelSessionKeys()
IncAppSessionKeys()
// api/rpc_router
IncRPCMessage(msgType rpc.MsgType, method string)
IncRPCRequest(method, path string, success bool)
ObserveRPCDuration(method, path string, success bool, duration time.Duration)
SetRPCConnections(applicationID string, count uint32)
IncRPCInflight(method string)
DecRPCInflight(method string)
// api/app_session_v1
IncAppStateUpdate(applicationID string)
IncAppSessionUpdateSigValidation(applicationID string, sigType app.AppSessionSignerTypeV1, success bool)
// Blockchain Worker
IncBlockchainAction(asset string, blockchainID uint64, actionType string, success bool)
// Event Listener
IncBlockchainEvent(blockchainID uint64, handledSuccessfully bool)
// store/database (instrumented via gorm callbacks; see metrics.RegisterDBCallbacks)
ObserveDBQueryDuration(queryKind string, duration time.Duration)
// Seeders publish 0-valued series for label tuples whose full domain is known at
// startup, so PromQL queries (and absent()-style alerts) return defined values
// during the cold-start window before any traffic or chain event has arrived.
SeedRPCMethodMetrics(methods []string, methodPaths map[string][]string)
SeedBlockchainEventMetrics(blockchainIDs []uint64)
}
RuntimeMetricExporter defines the interface for recording runtime metrics across various components of the system.
func NewNoopRuntimeMetricExporter ¶
func NewNoopRuntimeMetricExporter() RuntimeMetricExporter
func NewRuntimeMetricExporter ¶
func NewRuntimeMetricExporter(reg prometheus.Registerer) (RuntimeMetricExporter, error)
RuntimeMetricExporter exposes metrics related to runtime operations, such as API requests, channel state validations, and blockchain interactions.
Cardinality note: user_states_total, transactions_total and transactions_amount_total carry an application_id label. The value is self-declared by clients and bounded only by the ingress regex (pkg/app.ApplicationIDRegex, ~66 chars of [a-z0-9_-]). Operators running untrusted clients should monitor series count on these metrics and, if needed, add an allowlist or recording-rule aggregation before ingest.
type StoreMetricExporter ¶
type StoreMetricExporter interface {
SetAppSessions(applicationID string, status app.AppSessionStatus, count uint64)
SetChannels(asset string, status core.ChannelStatus, count uint64)
SetActiveUsers(asset, timeSpanLabel string, count uint64)
SetActiveAppSessions(applicationID, timeSpanLabel string, count uint64)
SetTotalValueLocked(domain, asset string, value float64)
SetNodeBalance(blockchainID, asset string, value float64)
SetUserBalanceTotal(blockchainID, asset string, value float64)
SetUserBalanceUnderfunded(blockchainID, asset string, value float64)
SetUserBalanceReleasable(blockchainID, asset string, value float64)
ResetAppSessions()
ResetChannels()
ResetTotalValueLocked()
ResetNodeBalance()
ResetUserBalances()
ResetActiveUsers(timeSpanLabel string)
ResetActiveAppSessions(timeSpanLabel string)
}
StoreMetricExporter defines the interface for setting metrics that are stored and updated by a separate metric worker.
The Reset* methods drop every series in their respective gauges so the next batch of Set* calls re-publishes a complete picture. Without this, label tuples that disappear from the store (e.g., the last open channel for an asset closes) would keep their previous non-zero value indefinitely because the underlying GROUP BY queries omit zero-count buckets. Callers should only reset after a successful query — resetting on error would blank a healthy gauge during a transient DB outage.
func NewStoreMetricExporter ¶
func NewStoreMetricExporter(reg prometheus.Registerer) (StoreMetricExporter, error)