Skip to content

feat(output): add WriterAsTraceConsumer adapter (PIPE-1024)#233

Merged
Dylan-M merged 1 commit into
mainfrom
dylanmyers/pipe-1024-trace-consumer-adapter
Jun 3, 2026
Merged

feat(output): add WriterAsTraceConsumer adapter (PIPE-1024)#233
Dylan-M merged 1 commit into
mainfrom
dylanmyers/pipe-1024-trace-consumer-adapter

Conversation

@Dylan-M
Copy link
Copy Markdown
Contributor

@Dylan-M Dylan-M commented Jun 2, 2026

Proposed Change

First PR in the PIPE-1024 traces embed migration stack. Adds the WriterAsTraceConsumer adapter in output/adapter.go, parallel to WriterAsLogConsumer and (in #229) WriterAsMetricConsumer. The adapter bridges any output.TraceWriter to an embed.TraceConsumer by pushing each span through WriteTrace.

Foundation PR — no generator wiring yet. PR 2 migrates generator/traces to construct against embed.TraceConsumer.

Tests

  • TestWriterAsTraceConsumerPushesEachSpan
  • TestWriterAsTraceConsumerStopsOnFirstError

Part of PIPE-1024.

Comment thread output/adapter.go
Comment on lines +42 to +44
func WriterAsTraceConsumer(w TraceWriter) embed.TraceConsumer {
return &writerAsTraceConsumer{w: w}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nil writer not guarded in constructor. Calling adapter with nil TraceWriter panics on WriteTrace

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. Added a nil-guard panic at construction time in WriterAsTraceConsumer with a clear message, plus a unit test for the panic path. Also applied the same symmetric fix to WriterAsLogConsumer (identical to the one in #229's branch) so the protection lands on main whichever stack merges first — patch-id should drop the duplicate when the second one rebases.

@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1024-trace-consumer-adapter branch from f6ebb9d to 7dc72c2 Compare June 3, 2026 12:29
@Dylan-M Dylan-M requested a review from eKuG June 3, 2026 12:30
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1024-trace-consumer-adapter branch from 7dc72c2 to 069816e Compare June 3, 2026 13:42
@Dylan-M Dylan-M force-pushed the dylanmyers/pipe-1024-trace-consumer-adapter branch from 069816e to 2178b70 Compare June 3, 2026 14:01
@Dylan-M Dylan-M added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit d03faaf Jun 3, 2026
19 checks passed
@Dylan-M Dylan-M deleted the dylanmyers/pipe-1024-trace-consumer-adapter branch June 3, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants