Skip to content

Commit

Permalink
Send active and inactive connections
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Nov 11, 2024
1 parent 1128970 commit 4fb166a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/compass-connections/src/stores/connections-store-redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,16 @@ const connectWithOptions = (
getExtraConnectionData(connectionInfo),
]);

const connections = getState().connections;
// Counting all connections, we need to filter out any connections currently being created
const totalConnectionsCount = Object.values(
connections.byId
).filter(({ isBeingCreated }) => !isBeingCreated).length;
const activeConnectionsCount =
getActiveConnectionsCount(connections);
const inactiveConnectionsCount =
totalConnectionsCount - activeConnectionsCount;

return {
is_atlas: isAtlas,
atlas_hostname: isAtlas ? resolvedHostname : null,
Expand All @@ -1751,6 +1761,8 @@ const connectWithOptions = (
server_arch: host.arch,
server_os_family: host.os_family,
topology_type: dataService.getCurrentTopologyType(),
num_active_connections: activeConnectionsCount,
num_inactive_connections: inactiveConnectionsCount,
...extraInfo,
};
},
Expand Down

0 comments on commit 4fb166a

Please sign in to comment.