Skip to content

Commit

Permalink
Merge #4323
Browse files Browse the repository at this point in the history
4323: RTView: node type. r=denisshevchenko a=denisshevchenko

Closes #4274 

Now we display a hammer icon if the node is a producer (based on a presence of `Forging` metrics).

Co-authored-by: Denis Shevchenko <denis.shevchenko@iohk.io>
  • Loading branch information
iohk-bors[bot] and Denis Shevchenko committed Aug 12, 2022
2 parents 7576d9b + 1913d70 commit 1d63ed5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cardano-tracer/docs/cardano-rtview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RTView is a part of `cardano-tracer` [service](https://github.com/input-output-h
5. [UI](#UI)
1. [Security Alert](#Security-Alert)
2. [Missing Metrics](#Missing-Metrics)
3. [Producer or Relay?](#Producer-or-Relay?)

# Introduction

Expand Down Expand Up @@ -180,3 +181,10 @@ When the node connects to `cardano-tracer` and RTView's page displays the first
2. The node _cannot_ provide corresponding metrics. For example, forging-related metrics make sense only for producer node, not for relay node.
3. The node doesn't provide corresponding metrics because of node's configuration. For example, it can specify severity filter for particular metric, so it just filtered out.
4. The node is incompatible with `cardano-tracer` (they were built from different branches of `cardano-node` repository). For example, particular metric may be renamed in the node, but `cardano-tracer` is still using outdated name.

## Producer or Relay?

If the node is configured as a _producer_ - i.e. it can forge the new blocks - you will see a hammer icon near the node's name. So, there are two possible reasons if you don't see this hammer icon:

1. The node is configured as a relay, not as a producer.
2. The node is not reported about its "producer status" yet.
12 changes: 12 additions & 0 deletions cardano-tracer/src/Cardano/Tracer/Handlers/RTView/UI/CSS/Own.hs
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,12 @@ span[data-tooltip] {
color: #f7967f;
}

.dark .rt-view-node-producer-label svg {
width: 22px;
margin-left: 10px;
color: lightgreen;
}

/********************* Light Theme *********************/

.light {
Expand Down Expand Up @@ -1125,6 +1131,12 @@ span[data-tooltip] {
.light .rt-view-test-status-message-fail {
color: #e6380d;
}

.light .rt-view-node-producer-label svg {
width: 22px;
margin-left: 10px;
color: green;
}
|]

chartTextLight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ addNodeColumn tracerEnv loggingConfig nodesErrors updateErrorsTimer nodeId@(Node
# set text "Node"
, image "has-tooltip-multiline has-tooltip-bottom rt-view-what-icon" whatSVG
# set dataTooltip "Node's name, taken from its configuration file"
, image "rt-view-node-producer-label has-tooltip-multiline has-tooltip-right" forgeSVG
## (id' <> "__node-producer-label")
# set dataTooltip "This node is a producer"
# hideIt
]
addNodeCell "basic-info" bi
addNodeCell "era" [ UI.span ## (id' <> "__node-era") #. "has-text-weight-semibold" # set text ""
Expand Down
21 changes: 21 additions & 0 deletions cardano-tracer/src/Cardano/Tracer/Handlers/RTView/Update/Nodes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ updateNodesUI tracerEnv@TracerEnv{teConnectedNodes, teAcceptedMetrics, teSavedTO
setBlockReplayProgress connected teAcceptedMetrics
setChunkValidationProgress connected teSavedTO
setLedgerDBProgress connected teSavedTO
setProducerMode connected teAcceptedMetrics
setLeadershipStats connected displayedElements teAcceptedMetrics
setEraEpochInfo connected displayedElements teAcceptedMetrics nodesEraSettings

Expand Down Expand Up @@ -254,6 +255,26 @@ setLedgerDBProgress connected savedTO = do
_ -> return ()
_ -> return ()

setProducerMode
:: Set NodeId
-> AcceptedMetrics
-> UI ()
setProducerMode connected acceptedMetrics = do
allMetrics <- liftIO $ readTVarIO acceptedMetrics
forM_ connected $ \nodeId@(NodeId anId) ->
whenJust (M.lookup nodeId allMetrics) $ \(ekgStore, _) ->
forMM_ (liftIO $ getListOfMetrics ekgStore) $ \(mName, _) ->
case mName of
"Forge.NodeIsLeader" -> showProducerMode anId
"Forge.NodeIsLeaderNum" -> showProducerMode anId
_ -> return ()
where
-- The presence of these metrics is a proof that this node is
-- configured as a producer, so display corresponding icon.
showProducerMode anId = do
window <- askWindow
findAndSet showInline window (anId <> "__node-producer-label")

setLeadershipStats
:: Set NodeId
-> DisplayedElements
Expand Down

0 comments on commit 1d63ed5

Please sign in to comment.