Skip to content

Commit

Permalink
Export replication lag in prometheus metrics (#646)
Browse files Browse the repository at this point in the history
* Export replication lag in prometheus metrics
  • Loading branch information
kickster97 authored and viktorerlingsson committed Sep 19, 2024
1 parent 007e928 commit 5231913
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lavinmq/http/controller/prometheus.cr
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ module LavinMQ
value: @amqp_server.stats_system_collection_duration_seconds.to_f,
type: "gauge",
help: "Time it takes to collect system metrics"})
writer.write({name: "total_connected_followers",
value: @amqp_server.@replicator.followers.size,
type: "gauge",
help: "Amount of follower nodes connected"})
@amqp_server.@replicator.followers.each_with_index do |f, i|
writer.write({name: "follower_lag_#{i}",
value: f.lag,
type: "gauge",
help: "Lag for follower on address: #{f.@socket.remote_address}"})
end
end

SERVER_METRICS = {:connection_created, :connection_closed, :channel_created, :channel_closed,
Expand Down

0 comments on commit 5231913

Please sign in to comment.