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

Function record_error_count

redis/observability/recorder.py:408–450  ·  view source on GitHub ↗

Record error count. Args: server_address: Server address server_port: Server port network_peer_address: Network peer address network_peer_port: Network peer port error_type: Error type (Exception) retry_attempts: Retry attempts is_int

(
    server_address: Optional[str] = None,
    server_port: Optional[int] = None,
    network_peer_address: Optional[str] = None,
    network_peer_port: Optional[int] = None,
    error_type: Optional[Exception] = None,
    retry_attempts: Optional[int] = None,
    is_internal: bool = True,
)

Source from the content-addressed store, hash-verified

406
407
408def record_error_count(
409 server_address: Optional[str] = None,
410 server_port: Optional[int] = None,
411 network_peer_address: Optional[str] = None,
412 network_peer_port: Optional[int] = None,
413 error_type: Optional[Exception] = None,
414 retry_attempts: Optional[int] = None,
415 is_internal: bool = True,
416) -> None:
417 """
418 Record error count.
419
420 Args:
421 server_address: Server address
422 server_port: Server port
423 network_peer_address: Network peer address
424 network_peer_port: Network peer port
425 error_type: Error type (Exception)
426 retry_attempts: Retry attempts
427 is_internal: Whether the error is internal (e.g., timeout, network error)
428
429 Example:
430 >>> record_error_count('localhost', 6379, 'localhost', 6379, ConnectionError(), 3)
431 """
432 global _metrics_collector
433
434 if _metrics_collector is None:
435 _metrics_collector = _get_or_create_collector()
436 if _metrics_collector is None:
437 return
438
439 try:
440 _metrics_collector.record_error_count(
441 server_address=server_address,
442 server_port=server_port,
443 network_peer_address=network_peer_address,
444 network_peer_port=network_peer_port,
445 error_type=error_type,
446 retry_attempts=retry_attempts,
447 is_internal=is_internal,
448 )
449 except Exception:
450 pass
451
452
453def record_pubsub_message(

Calls 2

record_error_countMethod · 0.80
_get_or_create_collectorFunction · 0.70