File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
compass-connections/src/stores Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -854,6 +854,10 @@ This event is fired when user successfully connects to a new server/cluster.
854854 - The OS family of the connected server.
855855- ** topology_type** (required): ` string `
856856 - The type of connected topology.
857+ - ** num_active_connections** (required): ` number `
858+ - The number of active connections.
859+ - ** num_inactive_connections** (required): ` number `
860+ - The number of inactive connections.
857861- ** auth_type** (optional): ` string | undefined `
858862 - Desktop only. The authentication type used in the connection.
859863- ** tunnel** (optional): ` string | undefined `
Original file line number Diff line number Diff line change @@ -1739,6 +1739,16 @@ const connectWithOptions = (
17391739 getExtraConnectionData ( connectionInfo ) ,
17401740 ] ) ;
17411741
1742+ const connections = getState ( ) . connections ;
1743+ // Counting all connections, we need to filter out any connections currently being created
1744+ const totalConnectionsCount = Object . values (
1745+ connections . byId
1746+ ) . filter ( ( { isBeingCreated } ) => ! isBeingCreated ) . length ;
1747+ const activeConnectionsCount =
1748+ getActiveConnectionsCount ( connections ) ;
1749+ const inactiveConnectionsCount =
1750+ totalConnectionsCount - activeConnectionsCount ;
1751+
17421752 return {
17431753 is_atlas : isAtlas ,
17441754 atlas_hostname : isAtlas ? resolvedHostname : null ,
@@ -1751,6 +1761,8 @@ const connectWithOptions = (
17511761 server_arch : host . arch ,
17521762 server_os_family : host . os_family ,
17531763 topology_type : dataService . getCurrentTopologyType ( ) ,
1764+ num_active_connections : activeConnectionsCount ,
1765+ num_inactive_connections : inactiveConnectionsCount ,
17541766 ...extraInfo ,
17551767 } ;
17561768 } ,
Original file line number Diff line number Diff line change @@ -790,6 +790,16 @@ type NewConnectionEvent = ConnectionScoped<{
790790 * The type of connected topology.
791791 */
792792 topology_type : string ;
793+
794+ /**
795+ * The number of active connections.
796+ */
797+ num_active_connections : number ;
798+
799+ /**
800+ * The number of inactive connections.
801+ */
802+ num_inactive_connections : number ;
793803 } & ExtraConnectionData ;
794804} > ;
795805
You can’t perform that action at this time.
0 commit comments