Skip to content

fix: filter dropped spans in upsert_span to match export behavior#1118

Merged
saksharthakkar merged 1 commit intomainfrom
fix/upsert-span-drop-langgraph
Jan 15, 2026
Merged

fix: filter dropped spans in upsert_span to match export behavior#1118
saksharthakkar merged 1 commit intomainfrom
fix/upsert-span-drop-langgraph

Conversation

@saksharthakkar
Copy link
Copy Markdown
Contributor

@saksharthakkar saksharthakkar commented Jan 15, 2026

Root Cause

OpenInference spans (LangGraph internal nodes like init, agent, route_agent) were appearing in LLMOps traces despite being marked with telemetry.filter=drop.

The LlmOpsHttpExporter had two export paths:

  • export() - batch export, had filtering via _should_drop_span()
  • upsert_span() - real-time upsert for live tracking, missing filtering

The agents package calls upsert_span() for live visibility, which bypassed the filtering.

Fix

Added the same _should_drop_span() check to upsert_span():

def upsert_span(self, span, status_override=None):
    if self._should_drop_span(span):  # ← Added this
        return SpanExportResult.SUCCESS
    # ... rest of method

Now both paths consistently filter spans marked for dropping.

Test plan

  • Unit test test_upsert_span_filters_dropped_spans passes
  • Run agent with OpenInference instrumentation and verify no LangGraph internal spans appear in LLMOps

🤖 Generated with Claude Code

@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Jan 15, 2026
@saksharthakkar saksharthakkar marked this pull request as ready for review January 15, 2026 05:31
@saksharthakkar saksharthakkar changed the title (wip) fix: filter dropped spans in upsert_span to match export behavior fix: filter dropped spans in upsert_span to match export behavior Jan 15, 2026
Spans marked with telemetry.filter=drop were bypassing filtering when
using upsert_span() for live tracking. Now both export() and upsert_span()
consistently skip these spans.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@saksharthakkar saksharthakkar force-pushed the fix/upsert-span-drop-langgraph branch from 89a6e6e to dabe5db Compare January 15, 2026 05:36
@saksharthakkar saksharthakkar merged commit a6990d8 into main Jan 15, 2026
157 of 159 checks passed
@saksharthakkar saksharthakkar deleted the fix/upsert-span-drop-langgraph branch January 15, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants