-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: extends single-node.sh script to support local tracing and traced data retrieval #3496
chore: extends single-node.sh script to support local tracing and traced data retrieval #3496
Conversation
…onfig-single-node-script
WalkthroughWalkthroughThe Changes
Recent Review DetailsConfiguration used: .coderabbit.yaml Files selected for processing (1)
Additional Context UsedShellCheck (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silly question but how do I pull the traced data? Do I need to have Grafana + Prometheus running locally and configure it to fetch from http://127.0.0.1:26661
?
[not blocking] but it would be cool if we had a script (perhaps in this one or a separate one) to launch a local Grafana + Prometheus that is already configured to fetch traced data from that endpoint. Alternatively, if we can use Grafana Cloud and not run Grafana + Prometheus locally, it would be nice if there was a step or screenshot on how to configure Grafana Cloud to read traced data from the single node running via this script.
Sure, I'll create an issue for this one, but, in the meanwhile, I have updated the PR description and explained how to locate the local traced data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
echo "Do you want to set up local tracing with the ability to pull traced data? [y/n]" | ||
read -r response | ||
if [[ $response == "y" ]]; then | ||
trace_type="local" | ||
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml | ||
trace_pull_address=":26661" | ||
sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" ${CELESTIA_APP_HOME}/config/config.toml | ||
trace_push_batch_size=1000 | ||
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml | ||
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider replacing [[ ]]
with [ ]
for POSIX compliance.
- if [[ $response == "y" ]]; then
+ if [ "$response" = "y" ]; then
This change ensures that the script remains compatible with all POSIX-compliant shells, as [[ ]]
is not defined in standard POSIX sh.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "Do you want to set up local tracing with the ability to pull traced data? [y/n]" | |
read -r response | |
if [[ $response == "y" ]]; then | |
trace_type="local" | |
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
trace_pull_address=":26661" | |
sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
trace_push_batch_size=1000 | |
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}" | |
fi | |
echo "Do you want to set up local tracing with the ability to pull traced data? [y/n]" | |
read -r response | |
if [ "$response" = "y" ]; then | |
trace_type="local" | |
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
trace_pull_address=":26661" | |
sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
trace_push_batch_size=1000 | |
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}" | |
fi |
read -r response | ||
if [[ $response == "y" ]]; then | ||
trace_type="local" | ||
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure variables are properly quoted to prevent word splitting and globbing issues.
- sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml
+ sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" "${CELESTIA_APP_HOME}/config/config.toml"
- sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" ${CELESTIA_APP_HOME}/config/config.toml
+ sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" "${CELESTIA_APP_HOME}/config/config.toml"
- sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml
+ sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" "${CELESTIA_APP_HOME}/config/config.toml"
Quoting the variable ${CELESTIA_APP_HOME}
prevents issues if the path contains spaces or special characters.
Also applies to: 101-101, 103-103
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" ${CELESTIA_APP_HOME}/config/config.toml | |
sed -i.bak -e "s/^trace_type *=.*/trace_type = \"$trace_type\"/" "${CELESTIA_APP_HOME}/config/config.toml" | |
sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" "${CELESTIA_APP_HOME}/config/config.toml" | |
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" "${CELESTIA_APP_HOME}/config/config.toml" |
sed -i.bak -e "s/^trace_pull_address *=.*/trace_pull_address = \"$trace_pull_address\"/" ${CELESTIA_APP_HOME}/config/config.toml | ||
trace_push_batch_size=1000 | ||
sed -i.bak -e "s/^trace_push_batch_size *=.*/trace_push_batch_size = \"$trace_push_batch_size\"/" ${CELESTIA_APP_HOME}/config/config.toml | ||
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the typo in the printed address for traced data.
- echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}"
+ echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1:${trace_pull_address}"
This change corrects the URL format by ensuring the port number is preceded by a colon, which aligns with the standard URL format.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1${trace_pull_address}" | |
echo "Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1:${trace_pull_address}" |
Cool thanks, asked out of curiosity :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log looks fixed to me: Tracing is set up with the ability to pull traced data from the node on the address http://127.0.0.1:26661
.
Tangent: I would also be okay with always enabling tracing and getting rid of the conditional prompt for y/n
The amount of traced data can become quite large, so I think it is prudent to let the user decide (note that local tracing by default is disabled). |
This PR extends the single-node.sh script by providing an option for the user to enable local tracing and retrieve traced data.
How to test
single-node.sh
under thescripts
foldery
toDo you want to set up local tracing with the ability to pull traced data? [y/n]
Also, the trace package from celestia-core has a method to pull the traced data which can be found here.