Skip to content

NH-143529 ResponseTime processor handles HTTP status code if non-compliant string#818

Merged
tammy-baylis-swi merged 3 commits into
mainfrom
NH-143529-status-code-defense
Jul 16, 2026
Merged

NH-143529 ResponseTime processor handles HTTP status code if non-compliant string#818
tammy-baylis-swi merged 3 commits into
mainfrom
NH-143529-status-code-defense

Conversation

@tammy-baylis-swi

Copy link
Copy Markdown
Contributor

Adds ResponseTime metrics processor handling and debug logging if HTTP status code is a string, to prevent stacktrace from APM library.

String status code is non-compliant but can still happen easily in practice, e.g. AWS Lambda function responses. Status code should be a 3-digit integer according to:

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.

Pull request overview

This PR hardens ResponseTimeProcessor so response-time metrics generation doesn’t raise when instrumentations emit non-compliant HTTP status code types (notably string values, e.g., some AWS Lambda responses). It fits into the SolarWinds APM OpenTelemetry distribution by making the span-to-metrics attribute extraction more resilient while keeping existing fallback behavior.

Changes:

  • Convert http.response.status_code / deprecated http.status_code to int when possible, with debug logging on invalid values.
  • Ensure HTTP request method values are coerced to str before being added to metric attributes.
  • Add unit tests covering string/invalid HTTP status codes and fallback behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
solarwinds_apm/trace/response_time_processor.py Adds status-code type coercion and debug logging; coerces request method to string for metric attributes.
tests/unit/test_processors/test_response_time_processor.py Adds coverage for string/invalid status code handling and expected logging behavior.

Comment thread solarwinds_apm/trace/response_time_processor.py Outdated
Comment thread solarwinds_apm/trace/response_time_processor.py Outdated
tammy-baylis-swi and others added 2 commits July 16, 2026 10:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tammy-baylis-swi
tammy-baylis-swi marked this pull request as ready for review July 16, 2026 17:03
@tammy-baylis-swi
tammy-baylis-swi requested review from a team as code owners July 16, 2026 17:03

@cheempz cheempz 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.

LGTM

@tammy-baylis-swi
tammy-baylis-swi merged commit 3e76139 into main Jul 16, 2026
52 checks passed
@tammy-baylis-swi
tammy-baylis-swi deleted the NH-143529-status-code-defense branch July 16, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants