Skip to content

Commit

Permalink
metric for project cache notification channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Oct 30, 2024
1 parent ebf1c52 commit 4fd4839
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion relay-server/src/services/projects/cache/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::services::projects::cache::handle::ProjectCacheHandle;
use crate::services::projects::cache::state::{CompletedFetch, Fetch, ProjectStore};
use crate::services::projects::project::ProjectState;
use crate::services::projects::source::ProjectSource;
use crate::statsd::RelayTimers;
use crate::statsd::{RelayGauges, RelayTimers};

/// Size of the broadcast channel for project events.
///
Expand Down Expand Up @@ -160,6 +160,11 @@ impl ProjectCacheService {
let _ = self
.project_events_tx
.send(ProjectChange::Ready(project_key));

metric!(
gauge(RelayGauges::ProjectCacheNotificationChannel) =
self.project_events_tx.len() as u64
);
}

fn handle_evict_stale_projects(&mut self) {
Expand Down
5 changes: 5 additions & 0 deletions relay-server/src/statsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub enum RelayGauges {
/// The number of idle connections in the Redis Pool.
#[cfg(feature = "processing")]
RedisPoolIdleConnections,
/// The number of notifications in the broadcast channel of the project cache.
ProjectCacheNotificationChannel,
}

impl GaugeMetric for RelayGauges {
Expand All @@ -61,6 +63,9 @@ impl GaugeMetric for RelayGauges {
RelayGauges::RedisPoolConnections => "redis.pool.connections",
#[cfg(feature = "processing")]
RelayGauges::RedisPoolIdleConnections => "redis.pool.idle_connections",
RelayGauges::ProjectCacheNotificationChannel => {
"project_cache.notification_channel.size"
}
}
}
}
Expand Down

0 comments on commit 4fd4839

Please sign in to comment.