Skip to content

Add Redis error classifications to Lettuce 4.0 and 5.0 - #20778

Merged
trask merged 19 commits into
mainfrom
copilot/add-redis-error-classifications
Oct 22, 2026
Merged

trask merged 19 commits into
mainfrom
copilot/add-redis-error-classifications

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Classify confirmed Redis server errors on Lettuce 4.0 and 5.0 command and batch spans and database duration metrics. For example, retry-later details produces error.type="retry-later".

Skip leading ASCII spaces, then preserve usable ASCII prefixes verbatim, including case, punctuation, tabs, and unrestricted length. Non-ASCII or missing prefixes and client failures retain exception-class fallback; successful operations omit error.type.

Keep application exception messages and transaction results unchanged. Batches follow the terminal exception when present, otherwise use request order, with client failures taking precedence over earlier server replies.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-22 15:14 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Redis server error classifications to Lettuce 4.0 and 5.0 Add Redis error classifications to Lettuce 4.0 and 5.0 Oct 20, 2026
Copilot AI requested a review from trask October 20, 2026 19:14
@trask
trask requested a balanced review from Copilot October 20, 2026 19:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cross-version error handling still needs human validation, and the integration tests have unresolved fixture dependencies.

2 open issues
What changed in this PR

Adds Redis server-error classification to Lettuce 4.0 and 5.0 command and batch telemetry while preserving exception-class fallback for client failures.

Changes:

  • Extracts validated Redis error prefixes.
  • Connects classification to command and batch attributes.
  • Adds getter tests and span/duration-metric assertions.
File Description
instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​unitTests/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceAttributesGetterTest.java Tests classification and fallback.
instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​test/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceAsyncClientTest.java Checks command and batch error telemetry.
instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceRedisErrorType.java Extracts validated error prefixes.
instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceDbAttributesGetter.java Classifies command errors.
instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceBatchAttributesGetter.java Classifies batch errors.
instrumentation/​lettuce/​lettuce-4.0/​javaagent/​src/​test/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceAsyncClientTest.java Checks command and batch error telemetry.
instrumentation/​lettuce/​lettuce-4.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceRedisErrorType.java Extracts validated error prefixes.
instrumentation/​lettuce/​lettuce-4.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceDbAttributesGetter.java Classifies command errors.
instrumentation/​lettuce/​lettuce-4.0/​javaagent/​src/​main/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceBatchAttributesGetter.java Classifies batch errors.
instrumentation/​lettuce/​lettuce-4.0/​javaagent-unit-tests/​src/​test/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceDbAttributesGetterTest.java Tests classification and fallback.

Review effort: Balanced

Initialize TESTHM with the existing hash fixture in each WRONGTYPE test. Wait for the setup command trace and clear captured telemetry before asserting the failing GET, preserving the expected contents of the other hash test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The review identified no blocking behavioral defects in the focused classification changes and their coverage.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 21, 2026 02:55
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 21, 2026 04:16
Co-authored-by: trask <218610+trask@users.noreply.github.com>
Copilot AI requested a review from trask October 22, 2026 05:58
@trask
trask requested a balanced review from Copilot October 22, 2026 06:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No blocking defects were identified; remaining feedback concerns nonblocking test-assertion completeness.

1 open issue
2 previously missed issues

In code that hasn't changed since last review

Low severity Assert complete attributes for EVAL errors

instrumentation/​lettuce/​lettuce-4.0/​javaagent/​src/​test/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v4_0/​LettuceAsyncClientTest.java:302

[Testing] Non-blocking: this assertion checks only error.type, so missing or unexpected EVAL attributes would pass. Use hasAttributesSatisfyingExactly(...) with the complete expected attributes, as required by .github/instructions/java-tests.instructions.md:140 and demonstrated by the non-ASCII EVAL test above.

Low severity Assert complete EVAL attributes in both tests

instrumentation/​lettuce/​lettuce-5.0/​javaagent/​src/​test/​java/​io/​opentelemetry/​javaagent/​instrumentation/​lettuce/​v5_0/​LettuceAsyncClientTest.java:307

[Testing] Non-blocking: this transaction assertion and the non-ASCII fallback assertion at line 354 check only error.type, so missing or unexpected database, query, and network attributes would pass. Use hasAttributesSatisfyingExactly(...) with the complete expected EVAL attributes in both tests, following .github/instructions/java-tests.instructions.md:140 and the WRONGTYPE test above.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review supports the error-classification and batch-selection behavior with no unresolved blocking issues; tests were not executed.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

…add-redis-error-classifications

Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved blocking issues were identified in error classification, exception preservation, batch completion, or the added coverage.

No open issues 🎉

Review effort: Balanced

…or-classifications

Co-authored-by: trask <218610+trask@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

Static review found no blocking issues in classification, fallback, or batch-error selection; tests were not executed.

No open issues 🎉

Review effort: Balanced

@trask
trask merged commit 958d08f into main Oct 22, 2026
70 checks passed
@trask
trask deleted the copilot/add-redis-error-classifications branch October 22, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants