-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added DEBUG_REDIS_EXPORTER variable #138
Added DEBUG_REDIS_EXPORTER variable #138
Conversation
WalkthroughThe changes introduce a new environment variable, Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
💤 Files not reviewed due to no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
falkordb-cluster/cluster-entrypoint.sh (1)
73-80
: LGTM: Improved signal handling for graceful shutdownsThe updates to the
handle_sigterm
function now ensure graceful shutdown of all processes, including the Redis exporter and health check. This is a good improvement for overall system stability.Consider adding a small delay (e.g.,
sleep 1
) after each kill command to allow processes to shut down gracefully before the script exits. This can help prevent any race conditions during shutdown. For example:if [[ $RUN_METRICS -eq 1 && ! -z $redis_exporter_pid ]]; then kill -TERM $redis_exporter_pid + sleep 1 fi if [[ $RUN_HEALTH_CHECK -eq 1 && ! -z $healthcheck_pid ]]; then kill -TERM $healthcheck_pid + sleep 1 fifalkordb-node/node-entrypoint.sh (1)
466-466
: LGTM: Proper usage of the new DEBUG_REDIS_EXPORTER variable.The
DEBUG_REDIS_EXPORTER
value is correctly exported asREDIS_EXPORTER_DEBUG
, allowing for independent control of the Redis exporter's debug mode. This change enhances the configurability of the system.For consistency with other environment variable usage in the script, consider using the following syntax:
- export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER" + export REDIS_EXPORTER_DEBUG=${DEBUG_REDIS_EXPORTER:-false}This change would ensure that if
DEBUG_REDIS_EXPORTER
is unset, it defaults tofalse
, maintaining consistency with how other variables are handled in the script.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- falkordb-cluster/cluster-entrypoint.sh (3 hunks)
- falkordb-node/node-entrypoint.sh (2 hunks)
- omnistrate.pro.yaml (6 hunks)
🔇 Additional comments not posted (11)
falkordb-cluster/cluster-entrypoint.sh (3)
48-48
: LGTM: New DEBUG_REDIS_EXPORTER variable addedThe addition of the
DEBUG_REDIS_EXPORTER
variable with a default value of 'false' aligns well with the PR objective. It provides a separate control for Redis exporter debugging, which enhances the configurability of the system.
304-304
: LGTM: Enhanced Redis exporter configuration and process managementThe addition of
export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER"
allows for dynamic control of the Redis exporter's debug mode. Capturing theredis_exporter_pid
enables graceful shutdown of the exporter process, which is consistent with the earlier changes to thehandle_sigterm
function.These modifications improve the overall manageability and configurability of the Redis exporter within the FalkorDB cluster setup.
Also applies to: 307-307
Line range hint
1-311
: Overall assessment: Changes look good with minor suggestions for improvementThe changes introduced in this PR successfully implement the new
DEBUG_REDIS_EXPORTER
variable and improve the process management for graceful shutdowns. These modifications align well with the PR objectives and enhance the configurability and stability of the FalkorDB cluster setup.A few minor suggestions have been made to further improve error handling, logging, and the shutdown process. These suggestions, if implemented, would contribute to making the script more robust and easier to troubleshoot.
Great job on these improvements!
falkordb-node/node-entrypoint.sh (1)
60-60
: LGTM: New environment variable for Redis exporter debugging added.The addition of
DEBUG_REDIS_EXPORTER
with a default value offalse
is appropriate and aligns with the PR objective. This change allows for independent control of the Redis exporter's debugging behavior.omnistrate.pro.yaml (7)
1099-1102
: Appropriate addition of DEBUG_REDIS_EXPORTER variableThe new environment variable
DEBUG_REDIS_EXPORTER=false
has been correctly added to thenode-sz
service configuration. This addition aligns with the PR objective and provides a dedicated control for Redis exporter debugging.
Line range hint
1173-1177
: Consistent addition of DEBUG_REDIS_EXPORTER to sentinel serviceThe
DEBUG_REDIS_EXPORTER=false
variable has been appropriately added to thesentinel-sz
service configuration. This ensures consistent debugging control across both node and sentinel services in the Single-Zone setup.
Line range hint
1584-1589
: Consistent implementation in Multi-Zone configurationThe
DEBUG_REDIS_EXPORTER=false
variable has been correctly added to thenode-mz
service in the Multi-Zone configuration. This demonstrates consistency in implementing the new debug control across different deployment scenarios.
Line range hint
1658-1664
: Comprehensive implementation across all servicesThe
DEBUG_REDIS_EXPORTER=false
variable has been appropriately added to thesentinel-mz
service in the Multi-Zone configuration. This change completes the implementation across all relevant services, ensuring a consistent approach to Redis exporter debugging control.
Line range hint
1969-1976
: Extension to cluster rebalance serviceThe
DEBUG_REDIS_EXPORTER=false
variable has been correctly added to thecluster-sz-rebalance
service in the Cluster Single-Zone configuration. This extends the Redis exporter debug control to the cluster rebalancing process, ensuring comprehensive coverage across all components.
Line range hint
2265-2273
: Complete implementation across all deployment scenariosThe
DEBUG_REDIS_EXPORTER=false
variable has been successfully added to thecluster-mz-rebalance
service in the Cluster Multi-Zone configuration. This final addition ensures that the Redis exporter debug control is consistently implemented across all deployment scenarios, including standalone, single-zone, multi-zone, and cluster configurations.
Line range hint
1099-2273
: Summary: Comprehensive implementation of Redis exporter debug controlThe changes in this PR successfully introduce the
DEBUG_REDIS_EXPORTER=false
environment variable across all relevant services in the FalkorDB deployment configuration. This implementation:
- Covers all deployment scenarios: standalone, single-zone, multi-zone, and cluster configurations.
- Maintains consistency across node, sentinel, and cluster rebalance services.
- Aligns perfectly with the PR objective to add a separate environment variable for controlling Redis exporter debugging.
The default value of
false
is appropriate for production environments, while still allowing easy enablement for debugging purposes when needed. This change enhances the configurability and usability of the Redis exporter within the FalkorDB system.
export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER" | ||
exporter_url=$(if [[ $TLS == "true" ]]; then echo "rediss://$NODE_HOST:$NODE_PORT"; else echo "redis://localhost:$NODE_PORT"; fi) | ||
redis_exporter -skip-tls-verification -redis.password $ADMIN_PASSWORD -redis.addr $exporter_url -log-format json -is-cluster | awk '{ print "**EXPORTER**: " $0 }' >>$FALKORDB_LOG_FILE_PATH & | ||
redis_exporter_pid=$! |
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.
🛠️ Refactor suggestion
Consider enhancing error handling and logging for Redis exporter
While the changes look good, consider adding error handling and logging for the Redis exporter startup. This can help with troubleshooting if there are issues with the exporter, especially when debug mode is enabled.
Here's a suggestion to improve this section:
echo "Starting Metrics"
export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER"
exporter_url=$(if [[ $TLS == "true" ]]; then echo "rediss://$NODE_HOST:$NODE_PORT"; else echo "redis://localhost:$NODE_PORT"; fi)
-redis_exporter -skip-tls-verification -redis.password $ADMIN_PASSWORD -redis.addr $exporter_url -log-format json -is-cluster | awk '{ print "**EXPORTER**: " $0 }' >>$FALKORDB_LOG_FILE_PATH &
-redis_exporter_pid=$!
+redis_exporter -skip-tls-verification -redis.password $ADMIN_PASSWORD -redis.addr $exporter_url -log-format json -is-cluster | awk '{ print "**EXPORTER**: " $0 }' >>$FALKORDB_LOG_FILE_PATH 2>&1 &
+redis_exporter_pid=$!
+if [ $? -ne 0 ]; then
+ echo "Failed to start Redis exporter" >&2
+ exit 1
+fi
+echo "Redis exporter started with PID $redis_exporter_pid"
This change adds error handling for the Redis exporter startup and logs the PID when it starts successfully. It also ensures that any error messages from the exporter are captured in the log file.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER" | |
exporter_url=$(if [[ $TLS == "true" ]]; then echo "rediss://$NODE_HOST:$NODE_PORT"; else echo "redis://localhost:$NODE_PORT"; fi) | |
redis_exporter -skip-tls-verification -redis.password $ADMIN_PASSWORD -redis.addr $exporter_url -log-format json -is-cluster | awk '{ print "**EXPORTER**: " $0 }' >>$FALKORDB_LOG_FILE_PATH & | |
redis_exporter_pid=$! | |
echo "Starting Metrics" | |
export REDIS_EXPORTER_DEBUG="$DEBUG_REDIS_EXPORTER" | |
exporter_url=$(if [[ $TLS == "true" ]]; then echo "rediss://$NODE_HOST:$NODE_PORT"; else echo "redis://localhost:$NODE_PORT"; fi) | |
redis_exporter -skip-tls-verification -redis.password $ADMIN_PASSWORD -redis.addr $exporter_url -log-format json -is-cluster | awk '{ print "**EXPORTER**: " $0 }' >>$FALKORDB_LOG_FILE_PATH 2>&1 & | |
redis_exporter_pid=$! | |
if [ $? -ne 0 ]; then | |
echo "Failed to start Redis exporter" >&2 | |
exit 1 | |
fi | |
echo "Redis exporter started with PID $redis_exporter_pid" |
…e-debugging-for-redis-exporter
…36-add-separate-env-var-to-enable-or-disable-debugging-for-redis-exporter
…-for-redis-exporter' of github.com:FalkorDB/falkordb-omnistrate into 136-add-separate-env-var-to-enable-or-disable-debugging-for-redis-exporter
fix #136
Summary by CodeRabbit
New Features
DEBUG_REDIS_EXPORTER
for enhanced control over the Redis exporter's debug mode.Bug Fixes
Documentation
DEBUG_REDIS_EXPORTER
variable across multiple services.REDIS_EXPORTER_DEBUG
variable, now controlled byDEBUG_REDIS_EXPORTER
.