Skip to content

Fix: OTelLinksResponse.count over-counts and writes a removed dropped field#4346

Open
justin212407 wants to merge 1 commit into
Agenta-AI:mainfrom
justin212407:tracing-ingest-issue
Open

Fix: OTelLinksResponse.count over-counts and writes a removed dropped field#4346
justin212407 wants to merge 1 commit into
Agenta-AI:mainfrom
justin212407:tracing-ingest-issue

Conversation

@justin212407
Copy link
Copy Markdown

@justin212407 justin212407 commented May 16, 2026

fixes: #4318

Summary

Fix silent over-counting in tracing ingest responses where OTelLinksResponse.count included dropped spans instead of only accepted spans.

Changes

  • Changed:
    count = len(links) + len(dropped)
    to:
    count = len(links)
  • Removed stale dropped=... kwarg (field was removed from model but was still being set)

Behavior

Before

  • Submitting N spans with K failures returned:
    • count = N
    • only N-K entries in links
  • This silently hid partial failures

After

  • count now accurately reflects only accepted spans

Testing

Verified locally.

Acceptance Validation

  • Fix validated with acceptance tests

QA Follow-up

  • Verify /tracing/spans/ingest with mixed valid/invalid span batches returns correct count
  • Confirm similar behavior on deprecated /tracing/traces/ingest path using the same patterns

Demo

Files Changed

  • router.py
    • Fix count calculation in ingest_spans (line ~303)

Checklist

  • Tests pass locally
  • Formatting and linting pass (ruff format + ruff check)
  • No breaking changes to public API contracts

… field

Signed-off-by: justin212407 <charlesjustin2124@gmail.com>
Copilot AI review requested due to automatic review settings May 16, 2026 10:47
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

@justin212407 is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels May 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 16, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The PR modifies the OpenTelemetry span ingestion response to report only accepted links in the response count and removes the dropped field from the response object, changing the API semantics for reporting span ingestion outcomes.

Changes

Span Ingestion Response Semantics

Layer / File(s) Summary
OTelLinksResponse count and dropped field update
api/oss/src/apis/fastapi/tracing/router.py
The ingest_spans method now constructs OTelLinksResponse with count computed from accepted links only (len(links)) and no longer includes a dropped field value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main fix: correcting the over-counting in OTelLinksResponse.count and removing the dropped field.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly explains the bug being fixed, the specific code changes made, the behavioral differences before and after, and includes testing/validation details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect OTelLinksResponse.count semantics in the tracing ingest endpoint so the response count reflects only spans successfully accepted/published (i.e., the number of returned links), and removes a stale dropped=... kwarg that no longer exists on the response model.

Changes:

  • Update /tracing/spans/ingest response count to len(links) (accepted spans only), instead of len(links) + len(dropped).
  • Remove the stale dropped=... argument when constructing OTelLinksResponse.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants