NH-143529 ResponseTime processor handles HTTP status code if non-compliant string#818
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/ deprecatedhttp.status_codetointwhen possible, with debug logging on invalid values. - Ensure HTTP request method values are coerced to
strbefore 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. |
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
marked this pull request as ready for review
July 16, 2026 17:03
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.
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: