{-# LANGUAGE RecordWildCards #-}
module Hydra.Logging.Monitoring.Metrics where
import Data.Map.Strict qualified as Map
import Hydra.Logging.Monitoring.Registry qualified as Registry
import Hydra.Prelude
import System.Metrics.Prometheus.Metric.Counter (Counter)
import System.Metrics.Prometheus.Metric.Gauge (Gauge)
import System.Metrics.Prometheus.Metric.Histogram (Histogram)
data Metrics = Metrics
{ Metrics -> Counter
headInputs :: Counter
, Metrics -> Counter
headRequestedTx :: Counter
, Metrics -> Counter
headConfirmedTx :: Counter
, Metrics -> Histogram
txConfirmationTime :: Histogram
, Metrics -> Histogram
snapshotConfirmationTime :: Histogram
, Metrics -> Map Text Counter
snapshots :: Map Text Counter
, Metrics -> Counter
evictedTimings :: Counter
, Metrics -> Gauge
peersConnected :: Gauge
, Metrics -> Gauge
chainDriftSeconds :: Gauge
, Metrics -> Gauge
chainLastBlockTimestampSeconds :: Gauge
, Metrics -> Gauge
chainBackendTimestamp :: Gauge
, Metrics -> Gauge
broadcastStalled :: Gauge
, Metrics -> Gauge
broadcastStalledNoProgress :: Gauge
, Metrics -> Gauge
broadcastStalledBacklogFull :: Gauge
, Metrics -> Gauge
pendingBroadcasts :: Gauge
, Metrics -> Gauge
broadcastNoProgressSeconds :: Gauge
, Metrics -> Counter
inputsRefusedBroadcastStalled :: Counter
, Metrics -> Map Text Counter
inputRetries :: Map Text Counter
, Metrics -> Map Text Counter
inputDrops :: Map Text Counter
, Metrics -> Map Text Histogram
inputProcessing :: Map Text Histogram
, Metrics -> Histogram
inputQueueWait :: Histogram
, Metrics -> Gauge
queuedInputs :: Gauge
, Metrics -> Gauge
parkedInputs :: Gauge
, Metrics -> Gauge
synced :: Gauge
, Metrics -> Map Text Gauge
phase :: Map Text Gauge
, Metrics -> Gauge
networkConnected :: Gauge
, Metrics -> Gauge
snapshotNumber :: Gauge
, Metrics -> Gauge
snapshotPending :: Gauge
, Metrics -> Gauge
missingSignatures :: Gauge
, Metrics -> Gauge
outstandingTransactions :: Gauge
, Metrics -> Map Text Counter
txOutcomes :: Map Text Counter
, Metrics -> Gauge
persistentDepth :: Gauge
, Metrics -> Gauge
persistentAge :: Gauge
, Metrics -> Histogram
putLatency :: Histogram
, Metrics -> Map Text Counter
networkEvents :: Map Text Counter
, Metrics -> Map Text Counter
chainFailures :: Map Text Counter
, Metrics -> Map Text Histogram
chainDuration :: Map Text Histogram
, Metrics -> Map Text Gauge
chainInflight :: Map Text Gauge
, Metrics -> Histogram
rollbackDepth :: Histogram
, Metrics -> Counter
blockfrostRetries :: Counter
, Metrics -> Counter
blockfrostRateLimits :: Counter
, Metrics -> Map Text Gauge
deposits :: Map Text Gauge
, Metrics -> Map Text Gauge
decommit :: Map Text Gauge
, Metrics -> Gauge
fanoutRemaining :: Gauge
, Metrics -> Map Text Gauge
fanoutMode :: Map Text Gauge
, Metrics -> Gauge
sqliteQueue :: Gauge
, Metrics -> Gauge
sqliteInflight :: Gauge
, Metrics -> Histogram
sqliteDuration :: Histogram
}
registerMetrics :: Registry.Registry -> Text -> IO Metrics
registerMetrics :: Registry -> Text -> IO Metrics
registerMetrics Registry
registry Text
backend = do
Counter
headInputs <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_inputs_total" Text
"Completed input processing attempts, including retries." []
Counter
headRequestedTx <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_requested_tx_total" Text
"ReqTx network messages first processed by this node; retries excluded and external duplicate messages included." []
Counter
headConfirmedTx <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_confirmed_tx_total" Text
"Transactions in newly confirmed or adopted snapshot numbers observed in this process; repeated adoption excluded." []
Histogram
txConfirmationTime <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_head_tx_confirmation_seconds" Text
"Time from first local processing of ReqTx to confirmation; excludes queue admission and unavailable timings." [Double]
latencyBuckets []
Histogram
snapshotConfirmationTime <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_head_snapshot_confirmation_seconds" Text
"Time from accepted SnapshotRequested after validation to confirmation of the same head, version and number." [Double]
latencyBuckets []
Map Text Counter
snapshots <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"signed", Text
"adopted"] ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_snapshots_total" Text
"New snapshot numbers observed, split by signed confirmation or adoption." [(Text
"source", Text
value)]
Counter
evictedTimings <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_monitoring_timing_evictions_total" Text
"Transaction timings discarded due to age or capacity; confirmation counters are unaffected." []
Gauge
peersConnected <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_peers_connected" Text
"Distinct connected peers observed by the processing loop." []
Gauge
chainDriftSeconds <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_chain_drift_seconds" Text
"Wall clock minus chain time at the latest processed tick; may be negative with clock skew." []
Gauge
chainLastBlockTimestampSeconds <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_chain_last_block_timestamp_seconds" Text
"Wall-clock time of the last tick processed by the main loop; zero before the first tick." []
Gauge
chainBackendTimestamp <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_chain_backend_last_block_timestamp_seconds" Text
"Wall-clock time of the last raw backend roll-forward; independent of main-loop progress." []
Gauge
broadcastStalled <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_broadcast_stalled" Text
"Live outbox stall predicate; independent of queued client notifications." []
Gauge
broadcastStalledNoProgress <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_broadcast_stalled_no_progress" Text
"Live outbox stall caused by no progress." []
Gauge
broadcastStalledBacklogFull <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_broadcast_stalled_backlog_full" Text
"Live outbox stall caused by the backlog limit." []
Gauge
pendingBroadcasts <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_pending_broadcasts" Text
"Messages in the outer network hand-off; excludes the persistent network queue." []
Gauge
broadcastNoProgressSeconds <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_broadcast_no_progress_seconds" Text
"Seconds without outer hand-off progress while it has pending messages." []
Counter
inputsRefusedBroadcastStalled <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_inputs_refused_broadcast_stalled_total" Text
"Client inputs refused because the outbound hand-off is stalled." []
Map Text Counter
inputRetries <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
waitReasons ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_node_input_waits_total" Text
"Wait outcomes by bounded reason, including inputs parked during catch-up." [(Text
"reason", Text
value)]
Map Text Counter
inputDrops <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
inputSources ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_node_input_drops_total" Text
"Inputs discarded after exhausting retry eligibility." [(Text
"source", Text
value)]
Map Text Histogram
inputProcessing <- [Text] -> (Text -> IO Histogram) -> IO (Map Text Histogram)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
inputSources ((Text -> IO Histogram) -> IO (Map Text Histogram))
-> (Text -> IO Histogram) -> IO (Map Text Histogram)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_node_input_processing_seconds" Text
"BeginInput-to-EndInput duration, including inline effects and synchronous trace handling." [Double]
latencyBuckets [(Text
"source", Text
value)]
Histogram
inputQueueWait <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_node_input_queue_wait_seconds" Text
"Time spent waiting for admission and dequeue on each attempt; retry delay and parked time excluded." [Double]
latencyBuckets []
Gauge
queuedInputs <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_node_input_queue_depth" Text
"Inputs currently admitted to the bounded processing queue." []
Gauge
parkedInputs <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_node_parked_inputs" Text
"Network inputs parked pending chain sync or awaiting readmission after sync." []
Gauge
synced <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_node_synced" Text
"One when the current node state is in sync." []
Map Text Gauge
phase <- [Text] -> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"idle", Text
"open", Text
"closed", Text
"fanout"] ((Text -> IO Gauge) -> IO (Map Text Gauge))
-> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_phase" Text
"Current head phase as a one-hot state set." [(Text
"phase", Text
value)]
Gauge
networkConnected <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_network_connected" Text
"Live network connectivity callback status; zero before a successful connection." []
Gauge
snapshotNumber <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_confirmed_snapshot_number" Text
"Current confirmed snapshot number; zero with no head." []
Gauge
snapshotPending <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_snapshot_inflight" Text
"One while a snapshot request is outstanding or signatures are being collected." []
Gauge
missingSignatures <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_snapshot_missing_signatures" Text
"Participants whose signatures are still missing from the outstanding snapshot." []
Gauge
outstandingTransactions <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_outstanding_transactions" Text
"Current allTxs entries awaiting inclusion in a snapshot." []
Map Text Counter
txOutcomes <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"applied", Text
"invalid", Text
"refused_stalled", Text
"refused_unsynced", Text
"rejected_state", Text
"decommit_invalid"] ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_head_transaction_outcomes_total" Text
"Transaction lifecycle events and refusals of NewTx or Decommit inputs; events are not unique transactions or mutually exclusive outcomes." [(Text
"outcome", Text
value)]
Gauge
persistentDepth <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_network_persistent_queue_depth" Text
"Messages awaiting successful etcd broadcast, including the pinned in-flight batch." []
Gauge
persistentAge <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_network_persistent_queue_oldest_age_seconds" Text
"Age of the oldest persisted queued message, using its file timestamp across restart." []
Histogram
putLatency <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_network_put_seconds" Text
"Duration of successful etcd put attempts, including deduplicated retries." [Double]
latencyBuckets []
Map Text Counter
networkEvents <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
networkEventsValues ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_network_events_total" Text
"Operational network failures, reconnects and lease warnings; routine deduplication and compaction recovery excluded." [(Text
"event", Text
value)]
Map Text Counter
chainFailures <- [Text] -> (Text -> IO Counter) -> IO (Map Text Counter)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
chainOperationsValues ((Text -> IO Counter) -> IO (Map Text Counter))
-> (Text -> IO Counter) -> IO (Map Text Counter)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_chain_operation_failures_total" Text
"Failed L1 protocol posts, API deposit drafts and user transaction submissions." [(Text
"operation", Text
value), (Text
"backend", Text
backend)]
Map Text Histogram
chainDuration <- [Text] -> (Text -> IO Histogram) -> IO (Map Text Histogram)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
chainOperationsValues ((Text -> IO Histogram) -> IO (Map Text Histogram))
-> (Text -> IO Histogram) -> IO (Map Text Histogram)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_chain_operation_seconds" Text
"L1 operation construction and backend submission duration; successful return does not imply on-chain inclusion." [Double]
operationLatencyBuckets [(Text
"operation", Text
value), (Text
"backend", Text
backend)]
Map Text Gauge
chainInflight <- [Text] -> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
chainOperationsValues ((Text -> IO Gauge) -> IO (Map Text Gauge))
-> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_chain_operations_inflight" Text
"L1 protocol posts, API deposit drafts and user transaction submissions currently executing, by operation." [(Text
"operation", Text
value), (Text
"backend", Text
backend)]
Histogram
rollbackDepth <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_chain_rollback_slots" Text
"Slots from the last backend roll-forward to the rollback point." [Double
0, Double
1, Double
10, Double
100, Double
1000, Double
10000, Double
100000] [(Text
"backend", Text
backend)]
Counter
blockfrostRetries <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_chain_blockfrost_retries_total" Text
"Retryable Blockfrost errors observed by the outer retry loop." [(Text
"backend", Text
backend)]
Counter
blockfrostRateLimits <- Registry -> Text -> Text -> [(Text, Text)] -> IO Counter
Registry.counter Registry
registry Text
"hydra_chain_blockfrost_rate_limits_total" Text
"HTTP 429 responses across node startup, wallet queries, chain polling and transaction submissions." [(Text
"backend", Text
backend)]
Map Text Gauge
deposits <- [Text] -> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"inactive", Text
"active", Text
"expired"] ((Text -> IO Gauge) -> IO (Map Text Gauge))
-> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_pending_deposits" Text
"Current unconsumed deposits tracked by this node, corrected by rollback." [(Text
"state", Text
value)]
Map Text Gauge
decommit <- [Text] -> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"none", Text
"requested", Text
"approved"] ((Text -> IO Gauge) -> IO (Map Text Gauge))
-> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_decommit_state" Text
"Current decommit state as a one-hot set." [(Text
"state", Text
value)]
Gauge
fanoutRemaining <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_fanout_remaining_outputs" Text
"Outputs still awaiting distribution in the current partial fanout state." []
Map Text Gauge
fanoutMode <- [Text] -> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text
"none", Text
"automatic", Text
"selected", Text
"deferred"] ((Text -> IO Gauge) -> IO (Map Text Gauge))
-> (Text -> IO Gauge) -> IO (Map Text Gauge)
forall a b. (a -> b) -> a -> b
$ \Text
value -> Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_head_fanout_mode" Text
"Current fanout mode as a one-hot set; deferred work is intentionally waiting for selection." [(Text
"mode", Text
value)]
Gauge
sqliteQueue <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_persistence_queue_depth" Text
"SQLite queue items awaiting the writer, including flush markers." []
Gauge
sqliteInflight <- Registry -> Text -> Text -> [(Text, Text)] -> IO Gauge
Registry.gauge Registry
registry Text
"hydra_persistence_write_inflight" Text
"One while a SQLite event batch is being encoded and committed." []
Histogram
sqliteDuration <- Registry
-> Text -> Text -> [Double] -> [(Text, Text)] -> IO Histogram
Registry.histogram Registry
registry Text
"hydra_persistence_write_seconds" Text
"SQLite batch encoding and transaction completion duration." [Double]
latencyBuckets []
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_inputs_total" Text
"hydra_head_inputs" Double
1
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_requested_tx_total" Text
"hydra_head_requested_tx" Double
1
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_confirmed_tx_total" Text
"hydra_head_confirmed_tx" Double
1
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_tx_confirmation_seconds" Text
"hydra_head_tx_confirmation_time_ms" Double
1000
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_snapshot_confirmation_seconds" Text
"hydra_head_snapshot_confirmation_time_ms" Double
1000
Registry -> Text -> Text -> Double -> IO ()
Registry.alias Registry
registry Text
"hydra_head_inputs_refused_broadcast_stalled_total" Text
"hydra_head_inputs_refused_broadcast_stalled" Double
1
Metrics -> IO Metrics
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Metrics{Map Text Counter
Map Text Gauge
Map Text Histogram
Counter
Gauge
Histogram
$sel:headInputs:Metrics :: Counter
$sel:headRequestedTx:Metrics :: Counter
$sel:headConfirmedTx:Metrics :: Counter
$sel:txConfirmationTime:Metrics :: Histogram
$sel:snapshotConfirmationTime:Metrics :: Histogram
$sel:snapshots:Metrics :: Map Text Counter
$sel:evictedTimings:Metrics :: Counter
$sel:peersConnected:Metrics :: Gauge
$sel:chainDriftSeconds:Metrics :: Gauge
$sel:chainLastBlockTimestampSeconds:Metrics :: Gauge
$sel:chainBackendTimestamp:Metrics :: Gauge
$sel:broadcastStalled:Metrics :: Gauge
$sel:broadcastStalledNoProgress:Metrics :: Gauge
$sel:broadcastStalledBacklogFull:Metrics :: Gauge
$sel:pendingBroadcasts:Metrics :: Gauge
$sel:broadcastNoProgressSeconds:Metrics :: Gauge
$sel:inputsRefusedBroadcastStalled:Metrics :: Counter
$sel:inputRetries:Metrics :: Map Text Counter
$sel:inputDrops:Metrics :: Map Text Counter
$sel:inputProcessing:Metrics :: Map Text Histogram
$sel:inputQueueWait:Metrics :: Histogram
$sel:queuedInputs:Metrics :: Gauge
$sel:parkedInputs:Metrics :: Gauge
$sel:synced:Metrics :: Gauge
$sel:phase:Metrics :: Map Text Gauge
$sel:networkConnected:Metrics :: Gauge
$sel:snapshotNumber:Metrics :: Gauge
$sel:snapshotPending:Metrics :: Gauge
$sel:missingSignatures:Metrics :: Gauge
$sel:outstandingTransactions:Metrics :: Gauge
$sel:txOutcomes:Metrics :: Map Text Counter
$sel:persistentDepth:Metrics :: Gauge
$sel:persistentAge:Metrics :: Gauge
$sel:putLatency:Metrics :: Histogram
$sel:networkEvents:Metrics :: Map Text Counter
$sel:chainFailures:Metrics :: Map Text Counter
$sel:chainDuration:Metrics :: Map Text Histogram
$sel:chainInflight:Metrics :: Map Text Gauge
$sel:rollbackDepth:Metrics :: Histogram
$sel:blockfrostRetries:Metrics :: Counter
$sel:blockfrostRateLimits:Metrics :: Counter
$sel:deposits:Metrics :: Map Text Gauge
$sel:decommit:Metrics :: Map Text Gauge
$sel:fanoutRemaining:Metrics :: Gauge
$sel:fanoutMode:Metrics :: Map Text Gauge
$sel:sqliteQueue:Metrics :: Gauge
$sel:sqliteInflight:Metrics :: Gauge
$sel:sqliteDuration:Metrics :: Histogram
headInputs :: Counter
headRequestedTx :: Counter
headConfirmedTx :: Counter
txConfirmationTime :: Histogram
snapshotConfirmationTime :: Histogram
snapshots :: Map Text Counter
evictedTimings :: Counter
peersConnected :: Gauge
chainDriftSeconds :: Gauge
chainLastBlockTimestampSeconds :: Gauge
chainBackendTimestamp :: Gauge
broadcastStalled :: Gauge
broadcastStalledNoProgress :: Gauge
broadcastStalledBacklogFull :: Gauge
pendingBroadcasts :: Gauge
broadcastNoProgressSeconds :: Gauge
inputsRefusedBroadcastStalled :: Counter
inputRetries :: Map Text Counter
inputDrops :: Map Text Counter
inputProcessing :: Map Text Histogram
inputQueueWait :: Histogram
queuedInputs :: Gauge
parkedInputs :: Gauge
synced :: Gauge
phase :: Map Text Gauge
networkConnected :: Gauge
snapshotNumber :: Gauge
snapshotPending :: Gauge
missingSignatures :: Gauge
outstandingTransactions :: Gauge
txOutcomes :: Map Text Counter
persistentDepth :: Gauge
persistentAge :: Gauge
putLatency :: Histogram
networkEvents :: Map Text Counter
chainFailures :: Map Text Counter
chainDuration :: Map Text Histogram
chainInflight :: Map Text Gauge
rollbackDepth :: Histogram
blockfrostRetries :: Counter
blockfrostRateLimits :: Counter
deposits :: Map Text Gauge
decommit :: Map Text Gauge
fanoutRemaining :: Gauge
fanoutMode :: Map Text Gauge
sqliteQueue :: Gauge
sqliteInflight :: Gauge
sqliteDuration :: Histogram
..}
latencyBuckets :: [Double]
latencyBuckets :: [Double]
latencyBuckets = [Double
0.001, Double
0.005, Double
0.01, Double
0.05, Double
0.1, Double
0.5, Double
1, Double
2.5, Double
5, Double
10, Double
30, Double
60, Double
120, Double
300]
operationLatencyBuckets :: [Double]
operationLatencyBuckets :: [Double]
operationLatencyBuckets = [Double
0.01, Double
0.1, Double
0.5, Double
1, Double
5, Double
30, Double
60, Double
300]
vector :: [Text] -> (Text -> IO a) -> IO (Map Text a)
vector :: forall a. [Text] -> (Text -> IO a) -> IO (Map Text a)
vector [Text]
values Text -> IO a
action = [(Text, a)] -> Map Text a
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(Text, a)] -> Map Text a) -> IO [(Text, a)] -> IO (Map Text a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Text -> IO (Text, a)) -> [Text] -> IO [(Text, a)]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (\Text
value -> (Text
value,) (a -> (Text, a)) -> IO a -> IO (Text, a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> IO a
action Text
value) [Text]
values
at :: (Ord key, Show key) => Map key a -> key -> a
at :: forall key a. (Ord key, Show key) => Map key a -> key -> a
at Map key a
values key
key = a -> Maybe a -> a
forall a. a -> Maybe a -> a
fromMaybe (Text -> a
forall a t. (HasCallStack, IsText t) => t -> a
error (Text -> a) -> Text -> a
forall a b. (a -> b) -> a -> b
$ Text
"Unregistered metric label: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> key -> Text
forall b a. (Show a, IsString b) => a -> b
show key
key) (key -> Map key a -> Maybe a
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup key
key Map key a
values)
inputSources :: [Text]
inputSources :: [Text]
inputSources = [Text
"client", Text
"network", Text
"chain"]
waitReasons :: [Text]
waitReasons :: [Text]
waitReasons = [Text
"transaction", Text
"snapshot_number", Text
"snapshot_version", Text
"seen_snapshot", Text
"transactions", Text
"contestation_deadline", Text
"decommit", Text
"unresolved_commit", Text
"unresolved_decommit", Text
"deposit_observation", Text
"deposit_activation", Text
"sync"]
networkEventsValues :: [Text]
networkEventsValues :: [Text]
networkEventsValues = [Text
"reconnect", Text
"broadcast_failure", Text
"watch_failure", Text
"authentication_failure", Text
"decode_failure", Text
"queue_storage_failure", Text
"queue_stat_failure", Text
"queue_full", Text
"lease_warning"]
chainOperationsValues :: [Text]
chainOperationsValues :: [Text]
chainOperationsValues = [Text
"draft_deposit", Text
"submit", Text
"init", Text
"increment", Text
"recover", Text
"decrement", Text
"close", Text
"contest", Text
"fanout", Text
"partial_fanout", Text
"final_fanout"]