Skip to content

Removed batch_size and consumer_name attributes from OTel metrics#3978

Merged
petyaslavova merged 3 commits intomasterfrom
vv-cleanup-attributes
Feb 25, 2026
Merged

Removed batch_size and consumer_name attributes from OTel metrics#3978
petyaslavova merged 3 commits intomasterfrom
vv-cleanup-attributes

Conversation

@vladvildanov
Copy link
Copy Markdown
Collaborator

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:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

@jit-ci
Copy link
Copy Markdown

jit-ci bot commented Feb 24, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.size and redis.client.consumer_name from the OTel attribute builders and updated call sites to stop populating them.
  • Added @deprecated_args warnings for batch_size / consumer_name parameters 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_name remains in the method signature but is no longer recorded as an OTel attribute. Please update the docstring/arg docs to clarify that consumer_name is 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_size is still part of this method signature, but it no longer affects the metric attributes being recorded. Please update the method documentation to explicitly mark batch_size as 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.

Copy link
Copy Markdown
Collaborator

@petyaslavova petyaslavova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@petyaslavova petyaslavova merged commit 74cbc8e into master Feb 25, 2026
176 of 179 checks passed
@petyaslavova petyaslavova deleted the vv-cleanup-attributes branch February 25, 2026 07:49
petyaslavova pushed a commit that referenced this pull request Feb 25, 2026
)

* Removed batch_size and consumer_name attributes from OTel metrics

* Exclude args from linters

* Left only #noqa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants