Skip to content

Commit 93801a1

Browse files
authored
feat(pool): Expose additional metrics from the redis pool (#4668)
1 parent 97b9182 commit 93801a1

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

relay-server/src/services/stats.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ impl RelayStats {
165165
gauge(RelayGauges::RedisPoolIdleConnections) = u64::from(stats.idle_connections),
166166
pool = name
167167
);
168+
metric!(
169+
gauge(RelayGauges::RedisPoolMaxConnections) = u64::from(stats.max_connections),
170+
pool = name
171+
);
172+
metric!(
173+
gauge(RelayGauges::RedisPoolWaitingForConnection) =
174+
u64::from(stats.waiting_for_connection),
175+
pool = name
176+
);
168177
}
169178

170179
#[cfg(not(feature = "processing"))]

relay-server/src/statsd.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ pub enum RelayGauges {
5050
/// The number of idle connections in the Redis Pool.
5151
#[cfg(feature = "processing")]
5252
RedisPoolIdleConnections,
53+
/// The maximum number of connections in the Redis pool.
54+
#[cfg(feature = "processing")]
55+
RedisPoolMaxConnections,
56+
/// The number of futures waiting to grab a connection.
57+
#[cfg(feature = "processing")]
58+
RedisPoolWaitingForConnection,
5359
/// The number of notifications in the broadcast channel of the project cache.
5460
ProjectCacheNotificationChannel,
5561
/// The number of scheduled and in progress fetches in the project cache.
@@ -88,6 +94,10 @@ impl GaugeMetric for RelayGauges {
8894
RelayGauges::RedisPoolConnections => "redis.pool.connections",
8995
#[cfg(feature = "processing")]
9096
RelayGauges::RedisPoolIdleConnections => "redis.pool.idle_connections",
97+
#[cfg(feature = "processing")]
98+
RelayGauges::RedisPoolMaxConnections => "redis.pool.max_connections",
99+
#[cfg(feature = "processing")]
100+
RelayGauges::RedisPoolWaitingForConnection => "redis.pool.waiting_for_connection",
91101
RelayGauges::ProjectCacheNotificationChannel => {
92102
"project_cache.notification_channel.size"
93103
}

0 commit comments

Comments
 (0)