anomalyco / anomalyco/opencode
[FEATURE]: Trace sampling knob (OPENCODE_TRACE_RATIO) for OTel export
Open
@neriousy is already working on this.
Since Aug 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
When OTEL_EXPORTER_OTLP_ENDPOINT is set, tracing is always-on: every span gets exported. A traced 80-minute session on a busy server produced ~320k spans / ~50MB to the collector, and today the only way to dial that down is removing the endpoint entirely.
I'd like an OPENCODE_TRACE_RATIO env var (default 1, i.e. unchanged behaviour) mapped to a ParentBased(TraceIdRatioBased) sampler. For example 0.1 would export ~10% of root traces while child spans stay consistent within a sampled trace. Patch ready to send.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.