getsentry / getsentry/sentry-javascript

Stream finished spans to stdout for local debugging

Aberta
#21,086 1 comentário 1 reação 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Core Feature javascript
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=1 environment variable (primary ergonomic win — drop it in .env or .bashrc and every process emits span data with zero code changes)

Implementation notes:

  • Must write to process.stdout directly, not console.log, to avoid recursion with console instrumentation
  • Registers as an additional SpanExporter on the existing OTel TracerProvider
  • 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

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. 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

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.