Remove collaborators_per_project from Metrics

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-29 17:19:14 +02:00
parent 63e1845537
commit f4e5cb14bf
2 changed files with 4 additions and 14 deletions

View file

@ -1097,10 +1097,9 @@ impl<'a> Drop for StoreWriteGuard<'a> {
let metrics = self.metrics();
tracing::info!(
connections = metrics.connections as f32,
registered_projects = metrics.registered_projects as f32,
shared_projects = metrics.shared_projects as f32,
collaborators_per_project = metrics.collaborators_per_project,
connections = metrics.connections,
registered_projects = metrics.registered_projects,
shared_projects = metrics.shared_projects,
"metrics"
);
}

View file

@ -86,7 +86,6 @@ pub struct Metrics {
pub connections: usize,
pub registered_projects: usize,
pub shared_projects: usize,
pub collaborators_per_project: f32,
}
impl Store {
@ -94,25 +93,17 @@ impl Store {
let connections = self.connections.len();
let mut registered_projects = 0;
let mut shared_projects = 0;
let mut collaborators = 0;
for project in self.projects.values() {
registered_projects += 1;
if let Some(share) = project.share.as_ref() {
if project.share.is_some() {
shared_projects += 1;
collaborators += share.active_replica_ids.len();
}
}
let collaborators_per_project = if shared_projects == 0 || collaborators == 0 {
0.
} else {
collaborators as f32 / shared_projects as f32
};
Metrics {
connections,
registered_projects,
shared_projects,
collaborators_per_project,
}
}