getsentry / getsentry/sentry-javascript
Stream finished spans to stdout for local debugging
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- TypeScript
- Estrelas
- 8.7k
- Forks
- 1.8k
- Merge médio
- 1d 18h
- PRs com merge (30d)
- 541
Descrição
Current behavior
The SDK captures spans via OpenTelemetry and exports them to Sentry. There is no built-in way to emit span data to stdout or the local logging system at runtime.
Gap
When building agents, most telemetry ends up in spans rather than logs. Developers currently need Spotlight (which requires a proxy/sidecar) to inspect spans locally. This is especially painful in agent-in-a-loop scenarios where the agent needs to self-debug — it has no way to see its own span data without external tooling.
Proposed behavior
Add an opt-in mode that streams each span to stdout as it finishes, one line per span. Output should include enough context to reconstruct parentage but does not need to render a tree — spans complete at different times so tree rendering isn't practical in a streaming model.
Minimal per-line fields:
- span name
- trace ID
- span ID
- parent span ID
- duration
- status
- key attributes (e.g.
op,description)
Activation options:
Sentry.init({ logSpans: true })SENTRY_LOG_SPANS=1environment variable (primary ergonomic win — drop it in.envor.bashrcand every process emits span data with zero code changes)
Implementation notes:
- Must write to
process.stdoutdirectly, notconsole.log, to avoid recursion with console instrumentation - Registers as an additional
SpanExporteron the existing OTelTracerProvider - Structured JSON by default for machine consumption; optional pretty format TBD
Context
This is an exploratory idea. The primary value proposition is agents self-debugging: when you're building an agent, most of the interesting telemetry is already in spans, not logs. Giving the agent (or developer) direct stdout visibility into its own trace data — without needing Spotlight or a proxy — fills a real gap.
Raised by David Cramer.
Action taken on behalf of David Cramer.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece localizando a integração existente de OTel TracerProvider e SpanExporter e, em seguida, rastreie como Sentry.init e a configuração SENTRY_LOG_SPANS entram no SDK. O trabalho estará concluído quando um exporter opt-in gravar diretamente em process.stdout um registro de span estruturado por linha, incluindo os campos de contexto solicitados, sem recursão da instrumentação de console.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- node.js, typescript
- Domínio
- observability-sre
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Pouca atividade
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 38/100