feat: add opt-in OpenTelemetry to chat turns and transcript loading#998
Draft
calebeden wants to merge 2 commits into
Draft
feat: add opt-in OpenTelemetry to chat turns and transcript loading#998calebeden wants to merge 2 commits into
calebeden wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c22819d0-eb50-4f50-9a60-c76ff17856af
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c22819d0-eb50-4f50-9a60-c76ff17856af
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: add opt-in OpenTelemetry to chat turns and transcript loading This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Native tray chat previously provided no OpenTelemetry visibility into a turn's
queueing, gateway admission, first-response latency, streaming duration, or
terminal outcome. Operators could see gateway diagnostics but could not explain
where time was spent from the Windows tray user's perspective.
Why This Change Was Made
This adds privacy-preserving chat lifecycle instrumentation with an explicit root
span per turn and sibling spans for send, response wait, and response receive.
Correlation identifiers remain process-local, exported values are finite and
low-cardinality, and prompts, responses, IDs, attachments, provider details, and
error messages are not exported.
Cross-process trace-context propagation into the gateway is intentionally left
for a separate coordinated gateway protocol change.
User Impact
Users who opt in to OpenTelemetry export can diagnose native chat latency and
outcomes in their existing collector without exposing conversation content.
Telemetry remains disabled when no endpoint is configured.
Evidence
The new tray spans and metrics were exercised through tracker and provider tests
covering local and remote turns, queueing and retries, first output, terminal
races, abort/reset/disconnect cleanup, bounded attributes, and privacy.
Screenshots
Change Type
Scope
winnodeValidation
.\build.ps1- passed; all five projects built successfully.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoreChatTelemetryTrackerTestsandOpenClawChatDataProviderTestsReal Behavior Proof
through an Aspire dashboard.
def4fe81message, and inspected the exported trace in Aspire.
openclaw.chat.turn,openclaw.chat.send,openclaw.chat.response.wait, andopenclaw.chat.response.receivewereexported.
response receive time without exported chat content or identifiers.
Yes/No/N/A): Yes - screenshots included aboveopenclaw.message.processedremains a separatetrace because the current gateway protocol does not accept propagated W3C trace
context.
Security Impact
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No): YesYes/No): NoYes/No): NoReview Conversations