MCPcopy
hub / github.com/redis/redis-py / record_connection_count

Function record_connection_count

redis/asyncio/observability/recorder.py:172–196  ·  view source on GitHub ↗

Record a connection count change for a single state. Args: pool_name: Connection pool identifier connection_state: State to update (IDLE or USED) counter: Number to add (positive) or subtract (negative)

(
    pool_name: str,
    connection_state: ConnectionState,
    counter: int = 1,
)

Source from the content-addressed store, hash-verified

170
171
172async def record_connection_count(
173 pool_name: str,
174 connection_state: ConnectionState,
175 counter: int = 1,
176) -> None:
177 """
178 Record a connection count change for a single state.
179
180 Args:
181 pool_name: Connection pool identifier
182 connection_state: State to update (IDLE or USED)
183 counter: Number to add (positive) or subtract (negative)
184 """
185 collector = _get_or_create_collector()
186 if collector is None:
187 return
188
189 try:
190 collector.record_connection_count(
191 pool_name=pool_name,
192 connection_state=connection_state,
193 counter=counter,
194 )
195 except Exception:
196 pass
197
198
199@deprecated_function(

Callers 2

get_connectionMethod · 0.90
releaseMethod · 0.90

Calls 2

_get_or_create_collectorFunction · 0.70

Tested by

no test coverage detected