dogmatiq / dogmatiq/enginekit

telemetry: remove span event emission from Recorder.Info and Recorder.Error

Open Beginner friendly
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
0
Forks
0
Avg merge
7m
Merged PRs (30d)
6

Description

Background

While designing observability for runkit I reviewed enginekit/telemetry in detail against what we need. Recorder.Info and Recorder.Error make one opinionated choice that is wrong for our use case -- and is probably wrong for persistencekit too.

Problem

Info and Error emit span events

Recorder.Info and Recorder.Error both call span.AddEvent(event) on the active span in addition to emitting an OTel log record.

This is unnecessary coupling. Log records already carry trace_id and span_id as first-class OTel log fields, which is sufficient for log-trace correlation in any compliant backend. Span events serve a different purpose -- annotating a span's timeline -- and that decision belongs to the caller, not the logger.

In practice, persistencekit calls Recorder.Info on every successful operation (e.g. journal.get.ok). Under load that's a large volume of span events that add no value.

Fix: remove span event emission from Info and Error entirely.

What to keep

  • Auto-counters on StartSpan (operations, operations_in_flight) -- these are sampling-independent, which means accurate operation throughput metrics at any trace sample rate. Worth keeping.
  • Error marking the active span (span.RecordError + span.SetStatus(codes.Error)) -- correct and desirable. If you're logging an error, the span should be marked as errored.
  • Auto error counter on Error -- same reasoning as operation counters.
  • Everything else in the package (Provider, Attr constructors, Instrument, NewSLogProvider, NewTestProvider) -- all fine as-is.

Impact on persistencekit

persistencekit uses Recorder.StartSpan, Info, Error, and metric instruments. The only behavioural change it would see is Info no longer emitting span events -- which is a net improvement.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the enginekit/telemetry package at the Recorder.Info and Recorder.Error entry points. Remove their span event emission while preserving Error's span error recording and status update, the log records, and counters. Done means Info and Error no longer add span events and the telemetry package tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.