3232from redis .observability .metrics import CloseReason , RedisMetricsCollector
3333from redis .observability .providers import get_observability_instance
3434from redis .observability .registry import get_observables_registry_instance
35- from redis .utils import str_if_bytes
35+ from redis .utils import deprecated_args , str_if_bytes
3636
3737if TYPE_CHECKING :
3838 from redis .connection import ConnectionPoolInterface
4646CSC_ITEMS_REGISTRY_KEY = "csc_items"
4747
4848
49+ @deprecated_args (
50+ args_to_warn = ["batch_size" ],
51+ reason = "The batch_size argument is no longer used and will be removed in the next major version." ,
52+ version = "7.2.1" ,
53+ )
4954def record_operation_duration (
5055 command_name : str ,
5156 duration_seconds : float ,
@@ -54,7 +59,7 @@ def record_operation_duration(
5459 db_namespace : Optional [str ] = None ,
5560 error : Optional [Exception ] = None ,
5661 is_blocking : Optional [bool ] = None ,
57- batch_size : Optional [int ] = None ,
62+ batch_size : Optional [int ] = None , # noqa
5863 retry_attempts : Optional [int ] = None ,
5964) -> None :
6065 """
@@ -100,7 +105,6 @@ def record_operation_duration(
100105 network_peer_address = server_address ,
101106 network_peer_port = server_port ,
102107 is_blocking = is_blocking ,
103- batch_size = batch_size ,
104108 retry_attempts = retry_attempts ,
105109 )
106110 except Exception :
@@ -436,11 +440,16 @@ def record_pubsub_message(
436440 pass
437441
438442
443+ @deprecated_args (
444+ args_to_warn = ["consumer_name" ],
445+ reason = "The consumer_name argument is no longer used and will be removed in the next major version." ,
446+ version = "7.2.1" ,
447+ )
439448def record_streaming_lag (
440449 lag_seconds : float ,
441450 stream_name : Optional [str ] = None ,
442451 consumer_group : Optional [str ] = None ,
443- consumer_name : Optional [str ] = None ,
452+ consumer_name : Optional [str ] = None , # noqa
444453) -> None :
445454 """
446455 Record the lag of a streaming message.
@@ -470,16 +479,20 @@ def record_streaming_lag(
470479 lag_seconds = lag_seconds ,
471480 stream_name = effective_stream_name ,
472481 consumer_group = consumer_group ,
473- consumer_name = consumer_name ,
474482 )
475483 except Exception :
476484 pass
477485
478486
487+ @deprecated_args (
488+ args_to_warn = ["consumer_name" ],
489+ reason = "The consumer_name argument is no longer used and will be removed in the next major version." ,
490+ version = "7.2.1" ,
491+ )
479492def record_streaming_lag_from_response (
480493 response ,
481494 consumer_group : Optional [str ] = None ,
482- consumer_name : Optional [str ] = None ,
495+ consumer_name : Optional [str ] = None , # noqa
483496) -> None :
484497 """
485498 Record streaming lag from XREAD/XREADGROUP response.
@@ -527,7 +540,6 @@ def record_streaming_lag_from_response(
527540 lag_seconds = lag_seconds ,
528541 stream_name = effective_stream_name ,
529542 consumer_group = consumer_group ,
530- consumer_name = consumer_name ,
531543 )
532544 else :
533545 # RESP2 format: list
@@ -546,7 +558,6 @@ def record_streaming_lag_from_response(
546558 lag_seconds = lag_seconds ,
547559 stream_name = effective_stream_name ,
548560 consumer_group = consumer_group ,
549- consumer_name = consumer_name ,
550561 )
551562 except Exception :
552563 pass
0 commit comments