Skip to content
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

Monitoring data exposed for cluster? #359

Open
lingpeng0314 opened this issue Jun 8, 2022 · 4 comments
Open

Monitoring data exposed for cluster? #359

lingpeng0314 opened this issue Jun 8, 2022 · 4 comments

Comments

@lingpeng0314
Copy link

Does Nuraft have any monitoring data exposed to monitor the status of raft quorum? like Prometheus format metrics or some events?

@greensky00
Copy link
Contributor

NuRaft has its own stats defined like this

NuRaft/src/buffer.cxx

Lines 89 to 96 in 9d7c4cb

static stat_elem& num_allocs = *stat_mgr::get_instance()->create_stat
(stat_elem::COUNTER, "num_buffer_allocs");
static stat_elem& amount_allocs = *stat_mgr::get_instance()->create_stat
(stat_elem::COUNTER, "amount_buffer_allocs");
static stat_elem& num_active = *stat_mgr::get_instance()->create_stat
(stat_elem::COUNTER, "num_active_buffers");
static stat_elem& amount_active = *stat_mgr::get_instance()->create_stat
(stat_elem::COUNTER, "amount_active_buffers");

and then gathered like this

_msg("num allocs: %zu\n"
"amount of allocs: %zu bytes\n"
"num active buffers: %zu\n"
"amount of active buffers: %zu bytes\n",
raft_server::get_stat_counter("num_buffer_allocs"),
raft_server::get_stat_counter("amount_buffer_allocs"),
raft_server::get_stat_counter("num_active_buffers"),
raft_server::get_stat_counter("amount_active_buffers"));

but not that many. If you want to export metrics to external components like Prometheus, you can put it in your event callbacks, state machine, or log store code. In eBay, we are reporting Raft-related metrics to Prometheus in that way.

@lingpeng0314
Copy link
Author

@greensky00 I see. Thanks for reply.

@lingpeng0314
Copy link
Author

@greensky00 The metrics you exported are in project Jungle? i didn't find related code block in repo. want to have an sample.

@greensky00
Copy link
Contributor

Jungle is another building block that is used for implementing log store and state machine. Metrics are defined in the upper layer that is using NuRaft and Jungle as a component, but that is not open-sourced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants