Skip to content

feat(otel): add TracingResponseFilter for error status codes#8098

Open
paoloantinori wants to merge 37 commits into
mainfrom
feat/otel-tracing-response-filter
Open

feat(otel): add TracingResponseFilter for error status codes#8098
paoloantinori wants to merge 37 commits into
mainfrom
feat/otel-tracing-response-filter

Conversation

@paoloantinori

Copy link
Copy Markdown
Member

Summary

Adds a ContainerResponseFilter that records HTTP response status codes on OpenTelemetry spans and marks server errors (5xx) with ERROR status (GitHub Issue #7150, item 6).

  • Sets http.response.status_code attribute (OTel semantic convention, long type)
  • 5xx responses set span status to ERROR with generic "HTTP <code>" description (no internal details leaked)
  • 4xx/3xx/2xx record the status code attribute but leave span status as UNSET (per OTel spec, 4xx is a client error, not a server error)
  • Adds ATTR_HTTP_RESPONSE_STATUS_CODE constant to OTelAttributes

Related Issues

Changes

File Change
TracingResponseFilter.java New @Provider response filter
OTelAttributes.java Add ATTR_HTTP_RESPONSE_STATUS_CODE
TracingResponseFilterTest.java 6 unit tests

Test plan

  • 200 OK — attribute set, span status UNSET
  • 301 Redirect — attribute set, span status UNSET
  • 404 Not Found — attribute set, span status UNSET
  • 500 Internal Server Error — attribute set, span status ERROR, description "HTTP 500"
  • 503 Service Unavailable — attribute set, span status ERROR, description "HTTP 503"
  • No active span — no-op, no exception
  • Checkstyle passes

Add a ContainerResponseFilter that records HTTP response status codes
on OpenTelemetry spans and marks 5xx server errors with ERROR status.

- Sets http.response.status_code attribute (OTel semconv standard)
- 5xx responses: span status set to ERROR with "HTTP <code>" description
- 4xx/3xx/2xx: status code recorded but span status left as UNSET
- 6 unit tests covering 200, 301, 404, 500, 503, and no-active-span

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions github-actions Bot added lifecycle/ready-for-review Ready for review, full tests running lifecycle/waiting-on-maintainer Blocked on maintainer action labels May 27, 2026
@github-actions

Copy link
Copy Markdown

PR auto-accepted (trusted author). Full test suite will run.

A maintainer can use /skip-review to skip the review requirement for small changes, or /auto-merge to merge automatically once approved and tested.

@github-actions

Copy link
Copy Markdown

The test suite was cancelled for commit eb063c2. See the workflow run. Use /retry to re-run.

@github-actions github-actions Bot added the lifecycle/tested Full test suite passed for current HEAD label May 27, 2026
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown

Verify — ✅ passed (run)

Phase Status
Lint and Validate 🟢
Build 🟢
Unit Tests 🟢
Integration Tests 🟢
Extra Tests 🟢
SDK Verification 🟢
CLI Verification
Operator Tests
Change detection

java: true, ui: false, integration: true, sdk: false, cli: false, go-sdk-gen: false, operator: false, ci: false

@paoloantinori

Copy link
Copy Markdown
Member Author

@carlesarnal gentle ping — this PR is ready for review whenever you have a moment. CI is green and all checks pass.

@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD and removed lifecycle/tested Full test suite passed for current HEAD labels May 28, 2026
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD and removed lifecycle/tested Full test suite passed for current HEAD labels May 28, 2026
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD and removed lifecycle/tested Full test suite passed for current HEAD labels May 29, 2026
@github-actions github-actions Bot added lifecycle/waiting-on-author Blocked on contributor action and removed lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action labels Jun 2, 2026
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

The test suite failed for commit 5da1f3b. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

The test suite failed for commit e00f425. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action and removed lifecycle/waiting-on-author Blocked on contributor action labels Jun 3, 2026
@github-actions github-actions Bot removed the lifecycle/tested Full test suite passed for current HEAD label Jun 3, 2026
@github-actions github-actions Bot removed the lifecycle/waiting-on-maintainer Blocked on maintainer action label Jun 16, 2026
@github-actions

Copy link
Copy Markdown

The test suite failed for commit 097b370. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions

Copy link
Copy Markdown

The test suite failed for commit 4eb38c1. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions

Copy link
Copy Markdown

The test suite failed for commit 5873a9d. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action and removed lifecycle/waiting-on-author Blocked on contributor action labels Jun 17, 2026
@github-actions github-actions Bot added lifecycle/waiting-on-author Blocked on contributor action and removed lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action labels Jun 17, 2026
@github-actions

Copy link
Copy Markdown

The test suite failed for commit 5dde5f1. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions

Copy link
Copy Markdown

The test suite failed for commit 1282406. @paoloantinori, please check the workflow run and push a fix.

Signed-off-by: Paolo Antinori <pantinor@redhat.com>
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action and removed lifecycle/waiting-on-author Blocked on contributor action labels Jun 17, 2026
@github-actions github-actions Bot added lifecycle/tested Full test suite passed for current HEAD and removed lifecycle/tested Full test suite passed for current HEAD labels Jun 17, 2026
@github-actions github-actions Bot removed the lifecycle/tested Full test suite passed for current HEAD label Jun 18, 2026
@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added the lifecycle/tested Full test suite passed for current HEAD label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/ready-for-review Ready for review, full tests running lifecycle/tested Full test suite passed for current HEAD lifecycle/waiting-on-maintainer Blocked on maintainer action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant