GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(telemetry): add OpenTelemetry instrumentation with Aspire Dashboard support by Hona · Pull Request #6629 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Jan 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Adds experimental OpenTelemetry support for debugging and observability.

What

  • Full OTEL instrumentation: all tools, MCP, sessions, LLM, LSP, plugins
  • Aspire Dashboard integration via bun run dev:otel
  • Service differentiation: opencode-cli vs opencode-server
  • Structured logs with full key=value context + exception stack traces
  • AI SDK telemetry with GenAI message content capture

Enabling OpenTelemetry

  1. Add to your global config (~/.config/opencode/opencode.json:
{
  "experimental": {
    "openTelemetry": true
  }
}
  1. Run with Aspire Dashboard:
cd packages/opencode
bun run dev:otel
  1. Open dashboard at http://localhost:18888

The OTEL_EXPORTER_OTLP_ENDPOINT env var controls the endpoint (defaults to http://localhost:4317).

Images

image image image image image image image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

slang25 and stuartlang-je reacted with hooray emoji Hona, slang25, stuartlang-je, and ThomasCarca reacted with rocket emoji
All reactions
  • 🎉 2 reactions
  • 🚀 4 reactions
Hona added 30 commits January 2, 2026 14:11
@Hona
Create plan.md
0afb363
@Hona
feat(otel): add @opentelemetry/api dependency for Aspire Dashboard in…
5fc301a
…tegration
@Hona
feat(otel): add @opentelemetry/api-logs dependency for structured log…
466f629
…ging
@Hona
docs: mark @opentelemetry/api-logs dependency as complete in plan.md
1530771
@Hona
feat(otel): add @opentelemetry/sdk-node dependency for telemetry SDK
d18935b
@Hona
feat(otel): add @opentelemetry/sdk-logs dependency for logging SDK
44b6734
@Hona
feat(otel): add @opentelemetry/resources dependency for resource attr…
67b08e0
…ibutes
@Hona
docs: mark @opentelemetry/resources dependency as complete in plan.md
8b9fbb6
@Hona
feat(otel): add @opentelemetry/semantic-conventions dependency for st…
ea9c6e3
…andard attribute names
@Hona
feat(otel): add npm scripts for Aspire Dashboard integration
ad92664
@Hona
feat(otel): add @opentelemetry/exporter-trace-otlp-grpc dependency fo…
210f7b1
…r gRPC trace export
@Hona
feat(otel): add @opentelemetry/exporter-logs-otlp-grpc dependency for…
192f806
… gRPC log export
@Hona
docs: mark exporter-logs-otlp-grpc dependency and bun install as comp…
65812b7
…lete
@Hona
feat(otel): extend openTelemetry config to support endpoint option
1557b55
Change experimental.openTelemetry config from boolean to union type
supporting both boolean and object with enabled/endpoint fields.
This allows users to configure custom OTLP endpoints for Aspire Dashboard
integration while maintaining backward compatibility with boolean config.
@Hona
feat(otel): implement Telemetry module with OpenTelemetry SDK integra…
43a94a6
…tion

Add telemetry module with:
- Config interface and resolveConfig() for endpoint resolution
- init() function with NodeSDK, LoggerProvider, trace/log exporters
- shutdown() for graceful cleanup
- withSpan() helper for span creation with error handling
- isEnabled(), getTracer(), getLogger() utility functions
- SeverityMap for log level mapping
@Hona
feat(otel): add OTEL logging bridge to emit logs to OpenTelemetry
e3d50d7
Integrate OpenTelemetry log emission into the Log module. When telemetry
is enabled, all log messages (debug/info/warn/error) are emitted to the
OTLP endpoint alongside file-based logging.

- Lazy-load telemetry module to avoid circular dependency
- Guard against recursive calls during module initialization
- Emit logs with proper severity levels using Telemetry.SeverityMap
@Hona
feat(otel): add startup integration for telemetry initialization
9df7253
- Initialize telemetry in yargs middleware after Log.init()
- Check OTEL_EXPORTER_OTLP_ENDPOINT env var or config.experimental.openTelemetry
- Register SIGTERM and SIGINT handlers for graceful shutdown
- Call Telemetry.shutdown() in finally block before process.exit()
@Hona
feat(otel): instrument Bash tool with OpenTelemetry spans
c591620
@Hona
feat(otel): instrument Read tool with OpenTelemetry spans
a7ce76f
@Hona
feat(otel): instrument Edit tool with OpenTelemetry spans
645ed5d
@Hona
feat(otel): instrument Write tool with OpenTelemetry spans
83e5ebe
@Hona
feat(otel): instrument Glob tool with OpenTelemetry spans
d4d2cee
@Hona
docs: mark Glob tool instrumentation complete in plan.md
875ac44
@Hona
feat(otel): instrument Grep tool with OpenTelemetry spans
5c1f2d4
@Hona
feat(otel): instrument WebFetch tool with OpenTelemetry spans
8de56f7
@Hona
feat(otel): instrument WebSearch tool with OpenTelemetry spans
a4dcae2
@Hona
docs: mark WebSearch tool instrumentation complete in plan.md
d1bc5f0
@Hona
feat(otel): instrument CodeSearch tool with OpenTelemetry spans
b806142
@Hona
feat(otel): instrument Task tool with OpenTelemetry spans
4139766
@Hona
docs: mark Task tool instrumentation complete in plan.md
6673d29
Hona added 16 commits March 23, 2026 22:14
@Hona
fix(telemetry): extract plain text from user message content parts
2aca9c0
@Hona
feat(telemetry): add gen_ai.choice event for Aspire GenAI output visu…
74e8eee
…alization
@Hona
fix(telemetry): include names in span labels (tool.execute read, plug…
f7f9a6a
…in.trigger chat.params, etc.)
@Hona
fix(telemetry): emit gen_ai.choice event and token usage on gen_ai.ch…
9bf3d71
…at span via onFinish, include tool parameters
@Hona
fix(telemetry): include agent name in gen_ai.chat span (gen_ai.chat b…
db26dca
…uild vs gen_ai.chat title)
@Hona
fix(telemetry): extract jsonSchema from AI SDK tool parameters for As…
627fefc
…pire tool definitions
@Hona
feat(telemetry): add SpanKind for icons - SERVER for HTTP, CLIENT for…
9c954a8
… DB and GenAI
@Hona
fix(telemetry): fix type errors - inputSchema not parameters, hunk.ty…
66579a3
…pe cast
@Hona
fix: update test to match LanguageModelV2ToolResultOutput type change
b349063
@Hona
fix(telemetry): remove db.operation wrapper and queue spans to reduce…
40b4bf2
… noise, fix test type
@Hona
feat(telemetry): add server.address for uninstrumented peer icons (DB…
f086eda
… icon, GenAI icon)
@Hona
fix(telemetry): remove duplicate gen_ai.choice event from processor (…
fd01989
…already emitted in onFinish)
@Hona
fix(telemetry): use actual API hostname as server.address on gen_ai.c…
d6bbc3b
…hat spans
@Hona
feat(telemetry): add undici auto-instrumentation for outgoing HTTP fe…
f72c835
…tch spans
@Hona
feat(telemetry): add fs and dns auto-instrumentation
ec18500
@Hona
feat(telemetry): add http and net auto-instrumentation for full netwo…
5c319e3
…rk stack
This was referenced Mar 23, 2026
fix: opencode run does not emit OTLP traces even with experimental.openTelemetry enabled #13438
Closed
feat: integrate OpenTelemetry #5245
Closed
[Feature]: otel-llm / openllmetry compatible spans DEVtheOPS/opencode-plugin-otel#19
Closed
Hona added 2 commits March 24, 2026 07:26
@Hona
feat: add suspicious_plugin demo for Aspire presentation (3s lag on b…
1c150f4
…ash tool calls)
@Hona
feat(telemetry): capture plugin and conversation events for Aspire tr…
43f8c4e
…aces
@bbartels

bbartels commented Mar 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@Hona Saw your presentation at aspire conf yesterday! Was quite keen to try out the Aspire Dashboard for aspire. Would this PR be needed to get this to work?

And would this work with the final built artefact as opposed to just with the dev environment for opencode? We would mainly be interested in it to help us track down issues with our installations of opencode

slang25 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slang25

slang25 commented Mar 24, 2026

Copy link
Copy Markdown

I saw the talk too and really want this 😅 are there plans for this to be merged?
Great talk by the way

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maxious

maxious commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

FYI robo-dax just closed #2666 and #6142 which I was also interested in for otel monitoring of opencode. Will this PR include those features?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 31, 2026
instrument #20311
Closed
@kitlangton kitlangton mentioned this pull request Apr 10, 2026
feat(opencode): bridge global OTel tracer for AI SDK telemetry #21799
Closed
4 tasks
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions github-actions Bot mentioned this pull request Apr 29, 2026
feat: add trace for whole workflow #24883
Closed
6 tasks
@rekram1-node

rekram1-node commented May 15, 2026

Copy link
Copy Markdown
Member

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up or heart reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node rekram1-node closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
+1 more reviewer
@strangemonad strangemonad strangemonad left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@Hona @strangemonad @giorgiopiatti-caffeinated @bbartels @slang25 @maxious @rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.