Skip to content

fix(tracing): exclude a2a-sdk instrumentation scope from LLMOps export#1753

Closed
PopescuTudor wants to merge 1 commit into
mainfrom
fix/drop-a2a-sdk-trace-scope
Closed

fix(tracing): exclude a2a-sdk instrumentation scope from LLMOps export#1753
PopescuTudor wants to merge 1 commit into
mainfrom
fix/drop-a2a-sdk-trace-scope

Conversation

@PopescuTudor

Copy link
Copy Markdown
Collaborator

Problem

The a2a-sdk auto-instruments its JSON-RPC transport — every method of JsonRpcTransport is wrapped under the OpenTelemetry instrumentation scope a2a-python-sdk, emitting spans like a2a.client.transports.jsonrpc.JsonRpcTransport.send_message/_get_http_args/_send_request. These render as noisy, unparented internal-method nodes in the execution trace and aren't meaningful execution spans.

Low-code agents already drop them, because the agent runtime exports through FilteringSpanExporter(filter_fn=is_custom_instrumentation_span) — and a2a-sdk spans aren't uipath.custom_instrumentation. But coded agents run with no span filter (settings=Nonespan_filter=None), so the a2a-sdk spans pass straight through to the trace.

Change

Drop spans from excluded third-party instrumentation scopes at the span-processor layer, before and independent of the optional UiPathTraceSettings.span_filter, so the exclusion applies to every agent (coded and low-code), ordering-independent and with no global env mutation:

  • uipath-core — add EXCLUDED_INSTRUMENTATION_SCOPES = frozenset({"a2a-python-sdk"}) and is_excluded_instrumentation_scope(span) in core/tracing/types.py, and apply it in UiPathExecutionTraceProcessorMixin.on_end (batch/simple export path).
  • uipath — apply the same check in LiveTrackingSpanProcessor.on_start / on_end (the live-upsert path that feeds the job Execution Trace).

The denylist is a single, extensible set, mirroring the existing is_custom_instrumentation_span filter convention.

Tests

  • uipath-core: is_excluded_instrumentation_scope matches a2a-sdk spans and ignores normal spans; a2a-sdk-scope spans are dropped even with span_filter=None (the coded path).
  • uipath: LiveTrackingSpanProcessor.on_start/on_end skip excluded-scope spans.
  • ruff, ruff format, mypy, and both packages' affected test modules pass locally (9/9 and 34/34).

Versioning

Bumps uipath-core 0.5.22→0.5.23 and uipath 2.11.12→2.11.13, and raises uipath's minimum on uipath-core to >=0.5.23 (co-changed internal packages).

🤖 Generated with Claude Code

https://claude.ai/code/session_01ELDu3m5eaURJrMVarc8VfY

@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Jun 24, 2026

@radu-mocanu radu-mocanu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Golden-rule review

The change drops third-party a2a-sdk instrumentation noise at the span-processor layer in uipath-core and uipath. Versions are bumped in both packages and the uipath->uipath-core minimum is raised to 0.5.23, with uv.lock updated. The one golden-rule concern is that this new always-on exclusion behavior is enabled unconditionally rather than gated behind an opt-in feature flag.

1 golden-rule violation(s) found:

  • [GR-4] packages/uipath-core/src/uipath/core/tracing/processors.py:42: New span-exclusion behavior is enabled unconditionally
    • The new always-on drop of a2a-python-sdk spans runs for every agent (coded and low-code) with no kill switch. New behavior should default OFF behind an env-var feature flag (UIPATH_FEATURE_) on a patch version, then flip the default on later.
    • Fix: Gate is_excluded_instrumentation_scope behind an env-var feature flag (default off), or document why this is a safe deterministic noise filter exempt from the flag policy.

Automated review against the repo's golden rules. Reply if a rule is misapplied.

"""Called when a span ends. Filters before delegating to parent."""
# Always drop third-party instrumentation noise, then apply the
# optional span filter.
if is_excluded_instrumentation_scope(span):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[GR-4] New span-exclusion behavior is enabled unconditionally

The new always-on drop of a2a-python-sdk spans runs for every agent (coded and low-code) with no kill switch. New behavior should default OFF behind an env-var feature flag (UIPATH_FEATURE_) on a patch version, then flip the default on later.

Fix: Gate is_excluded_instrumentation_scope behind an env-var feature flag (default off), or document why this is a safe deterministic noise filter exempt from the flag policy.

@PopescuTudor PopescuTudor force-pushed the fix/drop-a2a-sdk-trace-scope branch from 1e9bec2 to 0419526 Compare June 24, 2026 15:32
@PopescuTudor

Copy link
Copy Markdown
Collaborator Author

Addressed GR-4: the exclusion is now gated behind the UIPATH_FEATURE_ExcludeThirdPartyTraceScopes feature flag (default off), via the existing FeatureFlags manager, so it ships dark and the default can be flipped on in a later release once validated. is_excluded_instrumentation_scope returns False unless the flag is enabled; added tests for both the flag-on (dropped) and flag-off (kept) paths.

@PopescuTudor PopescuTudor self-assigned this Jun 24, 2026
The a2a-sdk auto-instruments its JSON-RPC transport (instrumentation scope
"a2a-python-sdk"), emitting one span per transport method. These surface as
noisy, unparented nodes in the execution trace and are not meaningful
execution spans. Low-code agents already drop them via the
custom_instrumentation span filter, but coded agents run with no span filter
(settings=None), so the noise reaches the trace.

Drop spans from excluded third-party instrumentation scopes at the
span-processor layer, before and independent of the optional
UiPathTraceSettings span_filter, so the exclusion applies to every agent
(coded and low-code):

- uipath-core: add EXCLUDED_INSTRUMENTATION_SCOPES +
  is_excluded_instrumentation_scope and apply it in
  UiPathExecutionTraceProcessorMixin.on_end.
- uipath: apply it in LiveTrackingSpanProcessor.on_start/on_end.

Gated behind the UIPATH_FEATURE_ExcludeThirdPartyTraceScopes feature flag
(default off); the default flips on in a later release once validated in the
field, per the safe-rollout convention.

Bumps uipath-core 0.5.22->0.5.23 and uipath 2.11.12->2.11.13, and raises
uipath's minimum on uipath-core to 0.5.23.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ELDu3m5eaURJrMVarc8VfY
@PopescuTudor PopescuTudor force-pushed the fix/drop-a2a-sdk-trace-scope branch from 0419526 to 1072167 Compare June 24, 2026 15:58
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants