Skip to content

Commit

Permalink
Merge #2303
Browse files Browse the repository at this point in the history
2303: CAD-2196: simplify node configuration for trace forwarder r=denisshevchenko a=denisshevchenko

Now, to configure the node for working with RTView, the user should make only one single change in the node's configuration file - add `traceForwardTo` section, for example:

```
  "traceForwardTo": {
    "tag": "RemoteSocket",
    "contents": [
      "0.0.0.0",
      "3000"
    ]
  }
```

In this case:

1. `TraceForwarder` plugin will be activated,
2. all metrics/peers/errors will be forwarded by adding to `mapBackends` section.

Please note that `TurnOnLogMetrics` flag should be enabled anyway (for tracing resources metrics), but in the default configuration this flag is already `true`.

Co-authored-by: Denis Shevchenko <denis.shevchenko@iohk.io>
  • Loading branch information
iohk-bors[bot] and Denis Shevchenko committed Jan 26, 2021
2 parents 9d62ffa + 200b513 commit 6e18a51
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 161 deletions.
18 changes: 17 additions & 1 deletion cardano-node/src/Cardano/Node/Configuration/Logging.hs
Expand Up @@ -42,7 +42,7 @@ import Cardano.BM.Configuration (Configuration)
import qualified Cardano.BM.Configuration as Config
import qualified Cardano.BM.Configuration.Model as Config
import Cardano.BM.Data.Aggregated (Measurable (..))
import Cardano.BM.Data.Backend (Backend, BackendKind)
import Cardano.BM.Data.Backend (Backend, BackendKind (..))
import Cardano.BM.Data.LogItem (LOContent (..), LOMeta (..), LoggerName)
import qualified Cardano.BM.Observer.Monadic as Monadic
import qualified Cardano.BM.Observer.STM as Stm
Expand Down Expand Up @@ -179,6 +179,12 @@ createLoggingLayer ver nodeConfig' p = do

Config.getForwardTo logConfig >>= \forwardTo ->
when (isJust forwardTo) $ do
-- Since the configuration contains 'traceForwardTo' section,
-- node's information (metrics/peers/errors) should be forwarded
-- to an external process (for example, RTView).

-- Activate TraceForwarder plugin (there is no need to add 'TraceForwarderBK'
-- to 'setupBackends' list).
nodeStartTime <- getCurrentTime
Cardano.BM.Backend.TraceForwarder.plugin logConfig
trace
Expand All @@ -187,6 +193,16 @@ createLoggingLayer ver nodeConfig' p = do
(nodeBasicInfo nodeConfig p nodeStartTime)
>>= loadPlugin switchBoard

-- Forward all the metrics/peers/errors to 'TraceForwarderBK' using 'mapBackends'.
-- If 'TraceForwarderBK' is already added in 'mapBackends' - ignore it.
let metricsLogger = "cardano.node.metrics" -- All metrics and peers info are here.
errorsLoggers = "cardano.node" -- All errors (messages with 'Warning+' severity) are here.

forM_ [metricsLogger, errorsLoggers] $ \loggerName ->
Config.getBackends logConfig loggerName >>= \backends ->
when (TraceForwarderBK `notElem` backends) $
Config.setBackends logConfig loggerName $ Just (TraceForwarderBK : backends)

Cardano.BM.Backend.Aggregation.plugin logConfig trace switchBoard
>>= loadPlugin switchBoard
Cardano.BM.Backend.Monitoring.plugin logConfig trace switchBoard
Expand Down
10 changes: 0 additions & 10 deletions configuration/chairman/byron-shelley/configuration.yaml
Expand Up @@ -255,17 +255,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down
12 changes: 0 additions & 12 deletions configuration/chairman/defaults/simpleview/config-0.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2997'.
# traceForwardTo:
Expand Down
12 changes: 0 additions & 12 deletions configuration/chairman/defaults/simpleview/config-1.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2998'.
# traceForwardTo:
Expand Down
12 changes: 0 additions & 12 deletions configuration/chairman/defaults/simpleview/config-2.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2999'.
# traceForwardTo:
Expand Down
10 changes: 0 additions & 10 deletions configuration/chairman/shelly-only/configuration.yaml
Expand Up @@ -246,17 +246,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down
10 changes: 0 additions & 10 deletions configuration/defaults/byron-mainnet/configuration.yaml
Expand Up @@ -243,17 +243,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down
16 changes: 2 additions & 14 deletions configuration/defaults/byron-staging/configuration.yaml
Expand Up @@ -60,12 +60,9 @@ TracingVerbosity: NormalVerbosity
# This setting lists the backends that will be available to use in the
# configuration below. The logging backend is called Katip. Also enable the EKG
# backend if you want to use the EKG or Prometheus monitoring interfaces.
# You can also enable trace forwarder backend if node should send the metrics
# to an external process.
setupBackends:
- KatipBK
# - EKGViewBK
# - TraceForwarderBK

# This specifies the default backends that trace output is sent to if it
# is not specifically configured to be sent to other backends.
Expand Down Expand Up @@ -220,17 +217,8 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# If 'TraceForwarderBK' is enabled, uncomment it to forward node's metrics

# Uncomment it to forward node's metrics
# to remote socket '127.0.0.1:2997'.
# traceForwardTo:
# tag: RemoteSocket
Expand Down
16 changes: 2 additions & 14 deletions configuration/defaults/byron-testnet/configuration.yaml
Expand Up @@ -60,12 +60,9 @@ TracingVerbosity: NormalVerbosity
# This setting lists the backends that will be available to use in the
# configuration below. The logging backend is called Katip. Also enable the EKG
# backend if you want to use the EKG or Prometheus monitoring interfaces.
# You can also enable trace forwarder backend if node should send the metrics
# to an external process.
setupBackends:
- KatipBK
# - EKGViewBK
# - TraceForwarderBK

# This specifies the default backends that trace output is sent to if it
# is not specifically configured to be sent to other backends.
Expand Down Expand Up @@ -220,17 +217,8 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# If 'TraceForwarderBK' is enabled, uncomment it to forward node's metrics

# Uncomment it to forward node's metrics
# to remote socket '127.0.0.1:2997'.
# traceForwardTo:
# tag: RemoteSocket
Expand Down
12 changes: 0 additions & 12 deletions configuration/defaults/simpleview/config-0.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2997'.
# traceForwardTo:
Expand Down
12 changes: 0 additions & 12 deletions configuration/defaults/simpleview/config-1.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2998'.
# traceForwardTo:
Expand Down
12 changes: 0 additions & 12 deletions configuration/defaults/simpleview/config-2.yaml
Expand Up @@ -10,9 +10,6 @@ rotation:
# these backends are initialized:
setupBackends:
- KatipBK
# Uncomment it to enable trace forwarder backend, if the node should
# forward metrics to an external process.
# - TraceForwarderBK

# if not indicated otherwise, then messages are passed to these backends:
defaultBackends:
Expand Down Expand Up @@ -47,15 +44,6 @@ options:
mapBackends:
cardano.node.metrics:
- EKGViewBK
# Uncomment it to send 'cardano.node.metrics' to 'TraceForwarderBK' as well.
# - TraceForwarderBK
# Uncomment it to send node's release, version and commit to 'TraceForwarderBK'.
# cardano.node.release:
# - TraceForwarderBK
# cardano.node.version:
# - TraceForwarderBK
# cardano.node.commit:
# - TraceForwarderBK

# Uncomment it to forward node's metrics to remote socket '127.0.0.1:2999'.
# traceForwardTo:
Expand Down
10 changes: 0 additions & 10 deletions scripts/lite/configuration/shelley-1.yaml
Expand Up @@ -241,17 +241,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down
10 changes: 0 additions & 10 deletions scripts/lite/configuration/shelley-2.yaml
Expand Up @@ -241,17 +241,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down
10 changes: 0 additions & 10 deletions scripts/lite/configuration/shelley-3.yaml
Expand Up @@ -241,17 +241,7 @@ options:
# go to the default backend, only to the explicitly listed backends.
mapBackends:
cardano.node.metrics:
- TraceForwarderBK
- EKGViewBK
cardano.node.release:
- TraceForwarderBK
- KatipBK
cardano.node.version:
- TraceForwarderBK
- KatipBK
cardano.node.commit:
- TraceForwarderBK
- KatipBK

# redirects traced values to a specific scribe which is identified by its
# type and its name, separated by "::":
Expand Down

0 comments on commit 6e18a51

Please sign in to comment.