-
Notifications
You must be signed in to change notification settings - Fork 21.1k
feat(telemetry): add OpenTelemetry instrumentation with Aspire Dashboard support #6629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 75 commits
Commits
Show all changes
227 commits
Select commit
Hold shift + click to select a range
0afb363
Create plan.md
Hona 5fc301a
feat(otel): add @opentelemetry/api dependency for Aspire Dashboard in…
Hona 466f629
feat(otel): add @opentelemetry/api-logs dependency for structured log…
Hona 1530771
docs: mark @opentelemetry/api-logs dependency as complete in plan.md
Hona d18935b
feat(otel): add @opentelemetry/sdk-node dependency for telemetry SDK
Hona 44b6734
feat(otel): add @opentelemetry/sdk-logs dependency for logging SDK
Hona 67b08e0
feat(otel): add @opentelemetry/resources dependency for resource attr…
Hona 8b9fbb6
docs: mark @opentelemetry/resources dependency as complete in plan.md
Hona ea9c6e3
feat(otel): add @opentelemetry/semantic-conventions dependency for st…
Hona ad92664
feat(otel): add npm scripts for Aspire Dashboard integration
Hona 210f7b1
feat(otel): add @opentelemetry/exporter-trace-otlp-grpc dependency fo…
Hona 192f806
feat(otel): add @opentelemetry/exporter-logs-otlp-grpc dependency for…
Hona 65812b7
docs: mark exporter-logs-otlp-grpc dependency and bun install as comp…
Hona 1557b55
feat(otel): extend openTelemetry config to support endpoint option
Hona 43a94a6
feat(otel): implement Telemetry module with OpenTelemetry SDK integra…
Hona e3d50d7
feat(otel): add OTEL logging bridge to emit logs to OpenTelemetry
Hona 9df7253
feat(otel): add startup integration for telemetry initialization
Hona c591620
feat(otel): instrument Bash tool with OpenTelemetry spans
Hona a7ce76f
feat(otel): instrument Read tool with OpenTelemetry spans
Hona 645ed5d
feat(otel): instrument Edit tool with OpenTelemetry spans
Hona 83e5ebe
feat(otel): instrument Write tool with OpenTelemetry spans
Hona d4d2cee
feat(otel): instrument Glob tool with OpenTelemetry spans
Hona 875ac44
docs: mark Glob tool instrumentation complete in plan.md
Hona 5c1f2d4
feat(otel): instrument Grep tool with OpenTelemetry spans
Hona 8de56f7
feat(otel): instrument WebFetch tool with OpenTelemetry spans
Hona a4dcae2
feat(otel): instrument WebSearch tool with OpenTelemetry spans
Hona d1bc5f0
docs: mark WebSearch tool instrumentation complete in plan.md
Hona b806142
feat(otel): instrument CodeSearch tool with OpenTelemetry spans
Hona 4139766
feat(otel): instrument Task tool with OpenTelemetry spans
Hona 6673d29
docs: mark Task tool instrumentation complete in plan.md
Hona 40bcd6c
feat(otel): instrument LSP tool with OpenTelemetry spans
Hona 9879948
feat(otel): instrument Skill tool with OpenTelemetry spans
Hona 38cca9a
docs: mark Skill tool instrumentation complete in plan.md
Hona a111a47
feat(otel): instrument List tool with OpenTelemetry spans
Hona 1577081
docs: mark List tool instrumentation complete in plan.md
Hona 427dee1
feat(otel): instrument Batch tool with OpenTelemetry spans
Hona 0dc18b9
feat(otel): instrument MultiEdit tool with OpenTelemetry spans
Hona 3783cf5
feat(otel): instrument TodoWrite and TodoRead tools with OpenTelemetr…
Hona 7fd5849
feat(otel): instrument MCP client connect with OpenTelemetry spans
Hona 86f4677
feat(otel): instrument MCP tool call with OpenTelemetry spans
Hona 91cc68f
docs: mark MCP tool call instrumentation complete in plan.md
Hona 26a3a8f
feat(otel): instrument MCP listTools with OpenTelemetry spans
Hona 39b82d0
docs: mark MCP listTools instrumentation complete in plan.md
Hona c0d24e6
feat(otel): instrument MCP listPrompts with OpenTelemetry spans
Hona d26bac7
docs: mark MCP listPrompts instrumentation complete in plan.md
Hona 209f1a1
feat(otel): instrument MCP getPrompt with OpenTelemetry spans
Hona d27c84e
feat(otel): instrument LLM stream with OpenTelemetry spans
Hona dcc9bd6
docs: mark LLM stream instrumentation complete in plan.md
Hona 0f00d05
feat(otel): instrument session processor with OpenTelemetry spans
Hona 54e504a
docs: mark session processor instrumentation complete in plan.md
Hona 782acdc
feat(otel): add telemetry instrumentation to session prompt
Hona c137468
feat(otel): instrument session.prompt.loop with OpenTelemetry tracing
Hona 1e3cbd6
docs: mark session.prompt.loop instrumentation complete in plan.md
Hona 3448c8a
feat(otel): instrument session compaction with OpenTelemetry tracing
Hona 656cbac
docs: mark session compaction instrumentation complete in plan.md
Hona d9c56cd
feat(otel): instrument session summary with OpenTelemetry tracing
Hona 79447f2
docs: mark session summary instrumentation complete in plan.md
Hona a9a1d05
feat(otel): instrument LSP client create with OpenTelemetry tracing
Hona 7489809
feat(otel): instrument LSP initialize request with OpenTelemetry tracing
Hona cb1fe4a
feat(otel): instrument LSP touchFile with OpenTelemetry tracing
Hona a69f7f8
feat(otel): instrument LSP definition request with OpenTelemetry tracing
Hona ad88f51
docs: mark LSP definition instrumentation complete in plan.md
Hona 74f82e3
feat(otel): instrument LSP references request with OpenTelemetry tracing
Hona b2b7cca
docs: mark LSP references instrumentation complete in plan.md
Hona 612e440
feat(otel): instrument LSP hover request with OpenTelemetry tracing
Hona a3e4c75
feat(otel): instrument Agent.generate with OpenTelemetry tracing
Hona fb00b8f
feat(otel): instrument Plugin trigger with OpenTelemetry tracing
Hona ae6bfa3
docs: mark Plugin trigger instrumentation complete in plan.md
Hona 79bf266
feat(otel): instrument Snapshot.track with OpenTelemetry tracing
Hona cd31a82
docs: mark Snapshot.track instrumentation complete in plan.md
Hona 86e6d81
feat(otel): instrument Snapshot.restore with OpenTelemetry tracing
Hona e6a046b
better name + wire up ai sdk otel
Hona b270e50
wip (i dont think either of these changes did anything)
Hona f2e9343
log format is weird and exceptions
Hona bb09006
we're done the plan
Hona 41b6169
refactor plan
Hona f844532
add flattenAttributes() utility for auto-capturing span attributes
Hona 145b717
add span() function with `using` support and export NOOP_SPAN
Hona e681ac3
mark tasks 1.1.2 and 1.1.3 complete in plan.md
Hona 0c5b9d1
add traced() higher-order function for function-level telemetry wrapping
Hona 1a2b9d6
add auto-instrumentation to Tool.define() for telemetry span wrapping
Hona a28d44b
mark task 1.4.1 complete: typecheck passes
Hona ba6b236
mark task 1.4.2 complete: telemetry exports verified
Hona bc80363
mark task 1.4.3 complete: Tool.define auto-instrumentation verified
Hona b1dbaa6
remove manual telemetry wrapper from glob.ts - auto-instrumentation h…
Hona 4505f14
mark task 2.1.1 complete: glob.ts telemetry wrapper removed
Hona 83d2a7c
remove manual telemetry wrapper from grep.ts - auto-instrumentation h…
Hona 989d304
mark task 2.1.2 complete: grep.ts telemetry wrapper removed
Hona 96b774a
remove manual telemetry wrapper from read.ts - auto-instrumentation h…
Hona 2c2f208
remove manual telemetry wrapper from write.ts - auto-instrumentation …
Hona 422780d
remove manual telemetry wrapper from edit.ts - auto-instrumentation h…
Hona 3b59d70
mark task 2.1.5 complete: edit.ts telemetry wrapper removed
Hona 8668ccd
remove manual telemetry wrapper from multiedit.ts - auto-instrumentat…
Hona 94ded13
mark task 2.1.6 complete: multiedit.ts telemetry wrapper removed
Hona 3511b33
remove manual telemetry wrapper from bash.ts - auto-instrumentation h…
Hona 725c688
mark task 2.1.7 complete: bash.ts telemetry wrapper removed
Hona 30008ea
remove manual telemetry wrapper from batch.ts - auto-instrumentation …
Hona b831685
mark task 2.1.8 complete: batch.ts telemetry wrapper removed
Hona a9a2853
remove manual telemetry wrapper from ls.ts - auto-instrumentation han…
Hona 6347359
mark task 2.1.9 complete: ls.ts telemetry wrapper removed
Hona 278bb94
remove manual telemetry wrapper from lsp.ts - auto-instrumentation ha…
Hona 390888d
mark task 2.1.10 complete: lsp.ts telemetry wrapper removed
Hona 3fc5d8b
remove manual telemetry wrapper from task.ts - auto-instrumentation h…
Hona 18657c3
mark task 2.1.11 complete: task.ts telemetry wrapper removed
Hona d57f80d
remove manual telemetry wrapper from skill.ts - auto-instrumentation …
Hona 87e008b
mark task 2.1.12 complete: skill.ts telemetry wrapper removed
Hona 53fc936
remove manual telemetry wrappers from todo.ts - auto-instrumentation …
Hona 7a2a084
remove manual telemetry wrapper from webfetch.ts - auto-instrumentati…
Hona 8a9e350
remove manual telemetry wrapper from websearch.ts - auto-instrumentat…
Hona 25a11f4
remove manual telemetry wrapper from codesearch.ts - auto-instrumenta…
Hona cd1fcf0
mark 2.1-checkpoint complete: all tool telemetry wrappers removed
Hona f3fa7b5
enhance codesearch.ts metadata with query, tokensNum, hasResults, sta…
Hona 2fcdb41
enhance edit.ts metadata with errorCount and fileExisted
Hona bc0f0ad
enhance grep.ts metadata with uniqueFiles count
Hona 5198149
enhance ls.ts metadata with directories count
Hona 9b7019a
enhance lsp.ts metadata with operation and resultCount
Hona 27200c8
mark task 2.2.6 complete in plan.md
Hona 3efb5a7
enhance multiedit.ts metadata with success/failure counts and totals
Hona 4efded3
mark task 2.2.7 complete in plan.md
Hona 358583f
enhance read.ts metadata with isImage, isBinary, linesRead, totalLine…
Hona ca4c06e
mark task 2.2.8 complete in plan.md
Hona 3148189
enhance skill.ts metadata with skillFound field
Hona 82114d8
mark task 2.2.9 complete in plan.md
Hona b3d72a4
enhance task.ts metadata with toolCallsCount and isNewSession
Hona f5b26c6
mark task 2.2.10 complete in plan.md
Hona 13c0fe2
enhance todo.ts (TodoWriteTool) metadata with completedCount and pend…
Hona 628eedf
mark task 2.2.11 complete in plan.md
Hona 85fbbd5
enhance todo.ts (TodoReadTool) metadata with todoCount and completedC…
Hona 8f54c7e
mark task 2.2.12 complete in plan.md
Hona 6da6b15
enhance webfetch.ts metadata with statusCode, contentType, and respon…
Hona 68ff30e
mark task 2.2.13 complete in plan.md
Hona 4183e05
enhance websearch.ts metadata with statusCode, resultCount, hasResult…
Hona b4d0b87
mark task 2.2.14 complete in plan.md
Hona c33f4c2
enhance write.ts metadata with errorCount and fileCreated
Hona 2b2700a
mark task 2.2.15 complete in plan.md
Hona f994f63
mark Phase 2.3 validation tasks complete in plan.md
Hona 476414a
refactor: use `using` syntax for session.prompt.loop span
Hona b8f504e
mark task 3.1.1 complete in plan.md
Hona 81c07b0
feat(telemetry): add per-step child spans in session prompt loop
Hona d04cff3
mark Phase 3 complete: session loop refactor validated
Hona 179795a
refactor(llm): migrate LLM.stream to traced() wrapper pattern
Hona dbf10ad
refactor(prompt): migrate SessionPrompt.prompt to traced() wrapper pa…
Hona 2e02853
mark task 4.1.2 complete in plan.md
Hona 5f2db2b
refactor(compaction): migrate SessionCompaction.process to traced() w…
Hona ceb46ec
refactor(summary): migrate SessionSummary.summarize to traced() wrapp…
Hona 7ccb6b6
refactor(processor): migrate SessionProcessor.process to using span p…
Hona 8f535d2
mark task 4.1.5 complete in plan.md
Hona f3b05d0
refactor(snapshot): migrate Snapshot.track to using span pattern
Hona afb1999
refactor(snapshot): migrate Snapshot.restore to traced() wrapper pattern
Hona d293723
mark task 4.2.2 complete in plan.md
Hona 489c91c
refactor(plugin): migrate Plugin.trigger to using span pattern
Hona a34477f
refactor(agent): migrate Agent.generate to using span pattern
Hona 098aaf4
mark task 4.2.4 complete in plan.md
Hona bf3fd16
mark Phase 4 validation tasks 4.3.1-4.3.4 complete
Hona 5d2663b
refactor(lsp): migrate touchFile to using span pattern
Hona c91a060
docs: mark LSP.touchFile migration complete in plan
Hona 1c7d098
refactor(lsp): migrate hover to traced() wrapper pattern
Hona fb2c7b7
docs: mark LSP.hover migration complete in plan
Hona 7d88cc3
refactor(lsp): migrate definition to traced() wrapper pattern
Hona 595cf7a
docs: mark LSP.definition migration complete in plan
Hona 36aab98
refactor(lsp): migrate references to traced() wrapper pattern
Hona 07226cd
docs: mark LSP.references migration complete in plan
Hona 470db3f
refactor(lsp): migrate LSPClient.create to using span pattern
Hona 8f5e09b
docs: mark LSPClient.create migration complete in plan
Hona 009634c
refactor(mcp): migrate fetchPromptsForClient to using span pattern
Hona c031f00
docs: mark fetchPromptsForClient migration complete in plan
Hona ae3ced3
refactor(mcp): migrate MCP.tools inner span to using span pattern
Hona 2228907
refactor(mcp): migrate MCP.getPrompt to using span pattern
Hona a88a59e
docs: mark MCP.getPrompt migration complete in plan
Hona bb04558
refactor(mcp): migrate client connection spans to using span pattern
Hona d8a2c49
docs: mark MCP client connection span migration complete in plan
Hona c4d94fb
docs: mark convertMcpTool review complete - keep withSpan inline
Hona 69876a8
docs: mark LSP module diff validation complete in plan
Hona 1ef8738
docs: complete Phase 5.3 validation and Phase 6.1-6.2 verification
Hona 90e4fd8
docs: mark test suite task 6.3.1 complete (518 pass, 0 fail)
Hona a953c41
docs: mark 6.5.1-6.5.2 complete with diff stats results
Hona 6cbe2eb
docs: mark 6.5.3 complete - verified no telemetry in tool execute fun…
Hona ee85577
docs: mark 6.5.4 complete - per-file diff summary shows framework fil…
Hona 8302f55
docs: mark 6.5.5 complete - verified clean diffs with no mass indenta…
Hona 4fa84ef
docs: mark 6.3.2 complete - bun dev manual test passes
Hona c53a52a
docs: mark 6.5.6 complete - final SLOC count comparison documented
Hona a45eabf
docs: mark OTel verification tasks complete after manual Aspire testing
Hona 1d693f7
Merge remote-tracking branch 'upstream/dev' into feat/aspire-otel
Hona dedd716
refacotr/clean done
Hona 8a519ff
feat(telemetry): add OTEL_EXPORTER_OTLP_ENDPOINT flag definition
Hona b7d08cb
docs: mark Phase 1 flag definition as completed
Hona f777fa8
feat(config): apply OTEL_EXPORTER_OTLP_ENDPOINT env var override at c…
Hona 2d66a6e
docs: mark Phase 2 config loading tasks as completed
Hona 3885f62
refactor(telemetry): simplify CLI entry points by removing direct env…
Hona fb02394
refactor(telemetry): simplify llm.ts telemetry check using Telemetry.…
Hona dbc67df
refactor(telemetry): simplify agent.ts telemetry check using Telemetr…
Hona 57dea6d
docs: mark agent.ts telemetry simplification as completed
Hona aebc273
refactor(telemetry): remove duplicate env var check from resolveConfig
Hona ff4d4c2
docs(telemetry): add inline comments explaining config precedence
Hona 27b3ef5
test(telemetry): add unit tests for telemetry configuration
Hona 9646c4f
docs(config): add OpenTelemetry experimental option documentation
Hona 91fddf2
docs(plan): mark OpenTelemetry refactor as complete
Hona 3b1922f
Delete plan.md
Hona 27349e3
simplify config lol
Hona 16f9bb9
kill dead tests
Hona a842b67
clean clean clean
Hona eb76917
generate
Hona e06f3ab
Merge remote-tracking branch 'upstream/dev' into feat/aspire-otel
Hona 060be35
Merge upstream/dev into feat/aspire-otel
Hona fe11ee1
feat(telemetry): comprehensive OpenTelemetry instrumentation for Aspi…
Hona 4a28c89
Merge remote-tracking branch 'origin/dev' into feat/aspire-otel
Hona 2819404
feat(telemetry): re-add OTEL instrumentation after merge with upstrea…
Hona e27289b
fix(telemetry): JSON-encode GenAI event content for Aspire Dashboard
Hona 5358fdb
fix(telemetry): use correct GenAI event content schema (role + conten…
Hona 2aca9c0
fix(telemetry): extract plain text from user message content parts
Hona 74e8eee
feat(telemetry): add gen_ai.choice event for Aspire GenAI output visu…
Hona f7f9a6a
fix(telemetry): include names in span labels (tool.execute read, plug…
Hona 9bf3d71
fix(telemetry): emit gen_ai.choice event and token usage on gen_ai.ch…
Hona db26dca
fix(telemetry): include agent name in gen_ai.chat span (gen_ai.chat b…
Hona 627fefc
fix(telemetry): extract jsonSchema from AI SDK tool parameters for As…
Hona 9c954a8
feat(telemetry): add SpanKind for icons - SERVER for HTTP, CLIENT for…
Hona 66579a3
fix(telemetry): fix type errors - inputSchema not parameters, hunk.ty…
Hona b349063
fix: update test to match LanguageModelV2ToolResultOutput type change
Hona 40b4bf2
fix(telemetry): remove db.operation wrapper and queue spans to reduce…
Hona f086eda
feat(telemetry): add server.address for uninstrumented peer icons (DB…
Hona fd01989
fix(telemetry): remove duplicate gen_ai.choice event from processor (…
Hona d6bbc3b
fix(telemetry): use actual API hostname as server.address on gen_ai.c…
Hona f72c835
feat(telemetry): add undici auto-instrumentation for outgoing HTTP fe…
Hona ec18500
feat(telemetry): add fs and dns auto-instrumentation
Hona 5c319e3
feat(telemetry): add http and net auto-instrumentation for full netwo…
Hona 1c150f4
feat: add suspicious_plugin demo for Aspire presentation (3s lag on b…
Hona 43f8c4e
feat(telemetry): capture plugin and conversation events for Aspire tr…
Hona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more of a code style question for the core opencode team but nesting the method implementations makes these harder to read, these are usually easier to read if they're implemented as a higher-order function wrapper or @ decorator.
Also, I believe most of these instrumentation points don't actually need to be instrumented since ai sdk will already instrument them. There's a few places were extra context (e.g. the sessionID) needs to be added in but the spans are otherwise being created, the main thing missing is running a trace collector.