Capture response details for non-2xx HTTP status codes#56
Open
nimishjs17 wants to merge 1 commit into
Open
Conversation
|
💚 CLA has been signed |
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.
Release notes
Added support for capturing HTTP status codes and error response bodies in the HTTP filter plugin. New configuration options
target_status_code,include_body_on_failure, andinclude_status_codeenable better error handling and debugging capabilities for failed HTTP requests.What does this PR do?
This PR enhances the HTTP filter plugin to capture and expose HTTP status codes and response bodies even for non-2xx responses, significantly improving error handling and debugging capabilities.
Changes implemented:
target_status_codeconfiguration: A configurable field to store HTTP status codes for all responses (successful and failed)include_body_on_failureoption: Controls whether to capture response body for failed requests (default: true)include_status_codeoption: Controls whether to always include the status code (default: true)Technical implementation:
filtermethod to capture status codes and response bodies for all scenariosprocess_responsemethod to handle error responses without losing dataWhy is it important/What is the impact to the user?
Current limitations:
Previously, the HTTP filter only added failure tags (
_httprequestfailure) for non-2xx responses without exposing:This made debugging API integrations difficult and prevented proper error handling in pipelines.
User benefits:
Example use case:
Checklist
Author's Checklist
How to test this PR locally
Related issues
Use cases
Scenario 1: API Rate Limiting
Given an API that returns 429 status with rate limit information
When the HTTP filter makes a request that triggers rate limiting
Then the status code (429) and response body (containing retry-after info) should be accessible
Scenario 2: API Validation Errors
Given an API that returns 400 with validation error details
When the HTTP filter sends invalid data
Then the validation errors in the response body should be accessible for logging/processing
Scenario 3: Service Unavailable
Given an API that is temporarily down (503)
When the HTTP filter attempts to connect
Then the 503 status should be captured for monitoring/alerting
Scenario 4: Network Issues
Given a network timeout or connection refused scenario
When the HTTP filter cannot establish connection
Then status code should be 0 with descriptive error message
Screenshots
Logs