rabbitmq / ra

A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Other
813 stars 96 forks source link

Is prometheus using the correct last written index value? #362

Closed SimonUnge closed 1 year ago

SimonUnge commented 1 year ago

Describe the bug

not sure if this is a bug or not, but better safe than sorry:

https://github.com/rabbitmq/ra/blob/37a56800d16ef25d69c315e170f8ec5faa42b8c0/src/ra_server.erl#L1396

If I look at the prometheus ‘schema’, the field is named raft_log_last_written_index, and the log does contain a last_written_index_term , a tuple of an index and a term. Should that value be used instead, by calling ra_log:last_written/1?

Reproduction steps

N/A

Expected behavior

N/A

Additional context

N/A

kjnilsson commented 1 year ago

Inside the ra log the word "written" has particular meaning which is akin to "fully written" i.e. persisted successfully to the WAL. I'm not sure it is necessary in the metrics to differentiate between fully written and a more generic written (i.e. it has been written but may be in flight to the underlying storage). If you want to inspect these it is better to use the ra counters instead.

SimonUnge commented 1 year ago

Understood! I'll close this ticket!

Thank you for the clarification!