Skip to content

in_opentelemetry: return not found for invalid endpoint#12064

Merged
edsiper merged 2 commits into
masterfrom
otlp-invalid-endpoint-12032
Jul 8, 2026
Merged

in_opentelemetry: return not found for invalid endpoint#12064
edsiper merged 2 commits into
masterfrom
otlp-invalid-endpoint-12032

Conversation

@edsiper

@edsiper edsiper commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #12032.

  • Return HTTP 404 for unknown OpenTelemetry input endpoints instead of HTTP 400.
  • Add the missing Not Found response message mapping for the new HTTP server response helper.
  • Add focused integration coverage for an invalid OTLP HTTP/2 endpoint.

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 endpoint instead of the expected 404.

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 -q
  • VALGRIND=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 -q
  • ctest --test-dir build -R flb-it-opentelemetry --output-on-failure
  • tests/integration/.venv/bin/python .github/scripts/commit_prefix_check.py
  • GITHUB_EVENT_NAME=pull_request GITHUB_BASE_REF=master tests/integration/.venv/bin/python .github/scripts/commit_prefix_check.py

Summary by CodeRabbit

  • Bug Fixes

    • Invalid OpenTelemetry HTTP/2 endpoints now return a proper 404 Not Found response instead of 400 Bad Request.
    • Response text now matches the 404 status more accurately.
  • Tests

    • Added integration coverage for invalid HTTP/2 OpenTelemetry requests.
    • Verified that bad endpoint requests do not create logs, metrics, or traces.

edsiper added 2 commits July 6, 2026 10:27
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df7f089f-2850-4cbe-b392-9bf39b7d4eb7

📥 Commits

Reviewing files that changed from the base of the PR and between 46e15a1 and a560b02.

📒 Files selected for processing (2)
  • plugins/in_opentelemetry/opentelemetry_prot.c
  • tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py

📝 Walkthrough

Walkthrough

The 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.

Changes

Invalid Endpoint 404 Response

Layer / File(s) Summary
404 status and message handling
plugins/in_opentelemetry/opentelemetry_prot.c
send_response_ng() sets response message to "Not Found" for 404 status; invalid endpoint fallback in opentelemetry_prot_handle_ng() changed from HTTP 400 to 404.
Integration test coverage
tests/integration/scenarios/in_opentelemetry/tests/test_in_opentelemetry_001.py
Adds test sending an HTTP/2 request to an invalid endpoint, asserting a 404 response and verifying no logs, metrics, or traces are stored.

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
Loading

Related issues: #12032 - OpenTelemetry input return 400 on invalid endpoint instead of 404

Suggested labels: bug, opentelemetry, tests

Suggested reviewers: none identified

🐰 A hopeful request to a path unknown,
Once got a 400, now stands alone —
"Not Found," it says, with proper cheer,
404 arrives, the fix is here!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: invalid OpenTelemetry endpoints now return Not Found/404.
Linked Issues check ✅ Passed The PR implements the requested 404 behavior for invalid OTLP endpoints and adds coverage for it.
Out of Scope Changes check ✅ Passed The response mapping and integration test are directly related to the linked invalid-endpoint fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch otlp-invalid-endpoint-12032

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@edsiper edsiper added this to the Fluent Bit v5.1 milestone Jul 8, 2026
@edsiper edsiper merged commit 5fd6b28 into master Jul 8, 2026
87 of 91 checks passed
@edsiper edsiper deleted the otlp-invalid-endpoint-12032 branch July 8, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenTelemetry input return 400 on invalid endpoint instead of 404

2 participants