in_opentelemetry: return not found for invalid endpoint#12064
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe OpenTelemetry input plugin's HTTP handler now returns HTTP 404 with a "Not Found" message for invalid endpoint requests, replacing the previous HTTP 400 response. An integration test was added to verify the new 404 behavior over HTTP/2 and confirm no data is stored. ChangesInvalid Endpoint 404 Response
Estimated code review effort: 1 (Trivial) | ~5 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant OTelInput as OpenTelemetry Input Plugin
participant Storage as data_storage
Client->>OTelInput: HTTP/2 request to invalid endpoint
OTelInput->>OTelInput: opentelemetry_prot_handle_ng() detects invalid endpoint
OTelInput->>OTelInput: send_response_ng() sets 404 "Not Found"
OTelInput-->>Client: HTTP 404 "error: invalid endpoint"
Note over Storage: No logs, metrics, or traces written
Related issues: Suggested labels: bug, opentelemetry, tests Suggested reviewers: none identified 🐰 A hopeful request to a path unknown, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #12032.
Not Foundresponse message mapping for the new HTTP server response helper.Root Cause
The OpenTelemetry input request dispatch treated endpoint mismatches as bad requests before method, payload, or content-type validation. That made an unknown OTLP path return
400 error: invalid endpointinstead of the expected404.Validation
tests/integration/.venv/bin/python -m pytest tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py::test_in_opentelemetry_http2_invalid_endpoint_returns_404 -qVALGRIND=1 VALGRIND_STRICT=1 tests/integration/.venv/bin/python -m pytest tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py::test_in_opentelemetry_http2_invalid_endpoint_returns_404 -qctest --test-dir build -R flb-it-opentelemetry --output-on-failuretests/integration/.venv/bin/python .github/scripts/commit_prefix_check.pyGITHUB_EVENT_NAME=pull_request GITHUB_BASE_REF=master tests/integration/.venv/bin/python .github/scripts/commit_prefix_check.pySummary by CodeRabbit
Bug Fixes
Tests