Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cardano-tracer: new changes, new tests for multi forwarders, EKG.
- Loading branch information
Denis Shevchenko
committed
Nov 25, 2021
1 parent
4f60dde
commit 66ab322
Showing
42 changed files
with
1,019 additions
and
642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# General reviewers per PR | ||
# Denis Serge | ||
* @denisshevchenko @deepfire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# cardano-tracer | ||
# Cardano Tracer | ||
|
||
`cardano-tracer` is an application for logging and monitoring over `cardano-node`. After it is connected to the node, it periodically asks the node for different information, receives it, and handles it. | ||
`cardano-tracer` is a service for logging and monitoring over `cardano-node`. After it is connected to the node, it periodically asks the node for different information, receives it, and handles it. | ||
|
||
For more details please [read the documentation](https://github.com/input-output-hk/cardano-node/blob/tracing-master/cardano-tracer/docs/cardano-tracer.md). | ||
For more details please [read the documentation](https://github.com/input-output-hk/cardano-node/blob/master/cardano-tracer/docs/cardano-tracer.md). | ||
|
||
## Developers | ||
|
||
Benchmarking team is responsible for this service. The primary developer is [@denisshevchenko](https://github.com/denisshevchenko). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"network": { | ||
"tag": "AcceptAt", | ||
"contents": "/tmp/forwarder.sock" | ||
}, | ||
"loRequestNum": 100, | ||
"ekgRequestFreq": 2, | ||
"hasEKG": [ | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3100 | ||
}, | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3101 | ||
} | ||
], | ||
"hasPrometheus": { | ||
"epHost": "127.0.0.1", | ||
"epPort": 3000 | ||
}, | ||
"logging": [ | ||
{ | ||
"logRoot": "/tmp/cardano-tracer-h-logs", | ||
"logMode": "FileMode", | ||
"logFormat": "ForHuman" | ||
}, | ||
{ | ||
"logRoot": "/tmp/cardano-tracer-m-logs", | ||
"logMode": "FileMode", | ||
"logFormat": "ForMachine" | ||
} | ||
], | ||
"rotation": { | ||
"rpFrequencySecs": 15, | ||
"rpKeepFilesNum": 1, | ||
"rpLogLimitBytes": 50000, | ||
"rpMaxAgeHours": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"network": { | ||
"tag": "ConnectTo", | ||
"contents": [ | ||
"/run/user/1000/cardano-tracer-demo-1.sock", | ||
"/run/user/1000/cardano-tracer-demo-2.sock", | ||
"/run/user/1000/cardano-tracer-demo-3.sock" | ||
] | ||
}, | ||
"hasEKG": [ | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3100 | ||
}, | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3101 | ||
} | ||
], | ||
"hasPrometheus": { | ||
"epHost": "127.0.0.1", | ||
"epPort": 3000 | ||
}, | ||
"logging": [ | ||
{ | ||
"logRoot": "/run/user/1000/cardano-tracer-demo-logs", | ||
"logMode": "FileMode", | ||
"logFormat": "ForMachine" | ||
} | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"network": { | ||
"tag": "AcceptAt", | ||
"contents": "/run/user/1000/cardano-tracer-demo-1.sock" | ||
}, | ||
"hasEKG": [ | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3100 | ||
}, | ||
{ | ||
"epHost": "127.0.0.1", | ||
"epPort": 3101 | ||
} | ||
], | ||
"hasPrometheus": { | ||
"epHost": "127.0.0.1", | ||
"epPort": 3000 | ||
}, | ||
"logging": [ | ||
{ | ||
"logRoot": "/run/user/1000/cardano-tracer-demo-logs", | ||
"logMode": "FileMode", | ||
"logFormat": "ForMachine" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "Usage: ./run.sh FMODE DELAY, where FMODE is forwarder's mode, Responder or Initiator, and DELAY is a working time in seconds." | ||
exit 1 | ||
fi | ||
|
||
rm -rf cardano-tracer demo-forwarder | ||
|
||
cabal build cardano-tracer && cabal install cardano-tracer --installdir=./ --overwrite-policy=always | ||
|
||
readonly FORWARDER_MODE=$1 | ||
readonly DELAY_IN_SECS=$2 | ||
|
||
readonly TMP_DIR=/run/user/1000 | ||
readonly TRACER_LOG_ROOT=${TMP_DIR}/cardano-tracer-demo-logs | ||
|
||
readonly SOCK_1=${TMP_DIR}/cardano-tracer-demo-1.sock | ||
readonly SOCK_2=${TMP_DIR}/cardano-tracer-demo-2.sock | ||
readonly SOCK_3=${TMP_DIR}/cardano-tracer-demo-3.sock | ||
|
||
rm -rf ${TRACER_LOG_ROOT} ${SOCK_1} ${SOCK_2} ${SOCK_3} | ||
mkdir ${TRACER_LOG_ROOT} | ||
|
||
echo "Run 3 demo-forwarders..." | ||
if [ "$FORWARDER_MODE" == "Responder" ] | ||
then | ||
# Run demo-forwarders in Responder mode, so they will accept connections from the tracer via 3 sockets. | ||
FORWARDER_1_PID=$(nohup ./demo-forwarder ${SOCK_1} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
FORWARDER_2_PID=$(nohup ./demo-forwarder ${SOCK_2} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
FORWARDER_3_PID=$(nohup ./demo-forwarder ${SOCK_3} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
else | ||
# Run demo-forwarders in Initiator mode, so they will connect to the tracer via the same socket. | ||
FORWARDER_1_PID=$(nohup ./demo-forwarder ${SOCK_1} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
FORWARDER_2_PID=$(nohup ./demo-forwarder ${SOCK_1} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
FORWARDER_3_PID=$(nohup ./demo-forwarder ${SOCK_1} ${FORWARDER_MODE} &>/dev/null & echo $!) | ||
fi | ||
|
||
echo "Run cardano-tracer..." | ||
if [ "$FORWARDER_MODE" == "Responder" ] | ||
then | ||
TRACER_CONFIG=active-tracer-config.json | ||
else | ||
TRACER_CONFIG=passive-tracer-config.json | ||
fi | ||
./cardano-tracer --config ${TRACER_CONFIG} | ||
|
||
#echo "Wait for ${DELAY_IN_SECS} seconds..." | ||
#sleep ${DELAY_IN_SECS} | ||
|
||
#echo "Stop..." | ||
#kill ${FORWARDER_1_PID} | ||
#kill ${FORWARDER_2_PID} | ||
#kill ${FORWARDER_3_PID} | ||
#kill ${TRACER_PID} | ||
|
||
#rm -rf cardano-tracer demo-forwarder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SSH Local Forwarding Demo | ||
|
||
Run `./run.sh PASS FMODE`, where `PASS` is your ssh password for `localhost`, and `FMODE` is forwarder's mode: `Responder` or `Initiator`. | ||
|
||
As a result, `demo-forwarder` and `cardano-tracer` will be launched on _different_ local sockets, so direct connection between them is impossible: | ||
|
||
``` | ||
+----------------+ +----------------+ | ||
| demo-forwarder |-> sock1 sock2 <-| cardano-tracer | | ||
+----------------+ +----------------+ | ||
``` | ||
|
||
That's why we initiate ssh local forwarding which connects these local sockets, so `demo-forwarder` can work with `cardano-tracer`: | ||
|
||
``` | ||
+----------------+ +----------------+ | ||
| demo-forwarder |-> sock1 <---SSH forwarding---> sock2 <-| cardano-tracer | | ||
+----------------+ +----------------+ | ||
``` | ||
|
||
Please note that if you run the script with `Responder` mode, `demo-forwarder` works as a server, and `cardano-tracer` works as a client: | ||
|
||
``` | ||
+----------------+ +----------------+ | ||
| demo-forwarder | <====connect====| cardano-tracer | | ||
+----------------+ +----------------+ | ||
``` | ||
|
||
otherwise, with `Initiator` mode, we have an opposite scenario: | ||
|
||
``` | ||
+----------------+ +----------------+ | ||
| demo-forwarder |====connect====> | cardano-tracer | | ||
+----------------+ +----------------+ | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
|
||
import System.Environment (getArgs) | ||
|
||
import Cardano.Tracer.Test.Forwarder | ||
|
||
main :: IO () | ||
main = getArgs >>= \case | ||
[localSock, "Initiator"] -> launchForwardersSimple Initiator localSock 1000 2000 | ||
[localSock, "Responder"] -> launchForwardersSimple Responder localSock 1000 2000 | ||
_ -> putStrLn "Usage: ./demo-forwarder Initiator|Responder /path/to/local/sock" |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
cardano-tracer/demo/run-ssh-forward-demo.sh → cardano-tracer/demo/ssh/run.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.