You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Propagation of trace/span ID into shell (and perhaps webfetch) tools #107
Currently the models cannot inject trace IDs/parent span IDs into the requests they're making because they don't see them.
This FR is similar to #62 but relates to builtin tools (generic shell invocation, webfetch) rather than MCPs.
Describe the solution you'd like
Assuming it's reasonably possible to do it with opencode's plugin architecture:
Since traceparent IDs are reasonably opaque (less problematic than much of the environment that's not being cleared away by OpenCode anyway -- api keys, etc), if OpenCode allows setting environment before invoking shell tool to execute commands, it would make sense to propagate the context via envvars. Then a script using curl could attach it as a header.
If possible for webfetch, it would make sense to attach it directly via the header -- in which case an allowlist of domains could be used as well.
I have not checked whether there's a properly standardized way, but I've spotted OTEL_BASH_PARENT_SPAN_ID and TRACEPARENT as possible environment variables to propagate (spotted in otel-bash). I don't know if SDK supports it, but it looks like otel-bash, terragrunt (reference) and otel-cli (reference) support TRACEPARENT.
Of course, this should be configurable and default to off.
Describe alternatives you've considered
Clearly a bad idea: Hack opencode-plugin-otel to write out desired env into tempfiles. Disable builtin opencode tools, and write custom MCPs for running bash commands and webfetch as described above. Hack opencode-plugin-pty to support the hacked env files.
Telemetry type
Other
Additional context
No response
Checklist
I have searched existing issues and discussions for similar feature requests
I have checked the changelog to see if this already exists
Activity