Removed batch_size and consumer_name attributes from OTel metrics#3978
Merged
petyaslavova merged 3 commits intomasterfrom Feb 25, 2026
Merged
Removed batch_size and consumer_name attributes from OTel metrics#3978petyaslavova merged 3 commits intomasterfrom
petyaslavova merged 3 commits intomasterfrom
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the batch_size and consumer_name attributes from emitted OpenTelemetry metric attributes while keeping the corresponding parameters temporarily available via deprecation warnings to avoid immediate API breakage.
Changes:
- Removed
db.operation.batch.sizeandredis.client.consumer_namefrom the OTel attribute builders and updated call sites to stop populating them. - Added
@deprecated_argswarnings forbatch_size/consumer_nameparameters in the observability recorder and metrics collector APIs. - Updated/removed tests that previously asserted presence of the removed attributes.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
redis/observability/attributes.py |
Removes the two semantic-convention attributes from the attribute builder output. |
redis/observability/recorder.py |
Deprecates args and stops forwarding removed attributes into metric recording. |
redis/observability/metrics.py |
Deprecates args and stops including removed attributes in recorded metric attributes. |
redis/client.py |
Stops passing batch_size into operation-duration metrics for pipelines/transactions. |
redis/cluster.py |
Stops passing batch_size into cluster pipeline/transaction duration metrics. |
redis/commands/core.py |
Stops passing consumer_name when recording streaming lag from XREADGROUP. |
tests/test_pipeline.py |
Updates assertions to require absence of db.operation.batch.size. |
tests/test_cluster.py |
Removes tests asserting db.operation.batch.size for cluster pipelines. |
tests/test_cluster_transaction.py |
Removes tests asserting db.operation.batch.size for transactions. |
tests/test_observability/test_recorder.py |
Removes usage/assertions for the removed consumer-name attribute and updates call sites. |
Comments suppressed due to low confidence (2)
redis/observability/metrics.py:601
consumer_nameremains in the method signature but is no longer recorded as an OTel attribute. Please update the docstring/arg docs to clarify thatconsumer_nameis deprecated and ignored so callers don't expect it to show up in metric attributes.
def record_streaming_lag(
self,
lag_seconds: float,
stream_name: Optional[str] = None,
consumer_group: Optional[str] = None,
consumer_name: Optional[str] = None,
) -> None:
redis/observability/metrics.py:443
batch_sizeis still part of this method signature, but it no longer affects the metric attributes being recorded. Please update the method documentation to explicitly markbatch_sizeas deprecated and ignored so callers don't expect it to appear in attributes.
def record_operation_duration(
self,
command_name: str,
duration_seconds: float,
server_address: Optional[str] = None,
server_port: Optional[int] = None,
db_namespace: Optional[int] = None,
batch_size: Optional[int] = None,
error_type: Optional[Exception] = None,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of change
Please provide a description of the change here.
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.