Why pouring is the trap
Pouring is easy, and that's exactly theproblem. Serializing the event onto the span takes a few lines of code, and youinstantly get rich context. But where do you draw the line? Every field in yourdomain model becomes telemetry by default, including the ones you would neverhave picked on purpose.
I call this projection without curation.
What pouring costs you
PII gets a second home. Automatic projection quietly extends your GDPR data map to your observability vendor, which typically means different hosting, different retention, and no link to your right to erasure.The more useful an identifier is for debugging, the more it behaves like personal data.
Coupling nobody tests. Telemetry is just another consumer of your events, but an unowned one. A dashboard built on order.value isn't covered by your contract tests and isn't versioned with theevent. A migration can pass every one of your consumer tests and still break anSLO alert at 3 a.m.
Cardinality nobody picked. Unbounded fields, like a line itemID or a free-text note, will blow up your storage costs if there's no editorial step to constrain them.
The fix: a projection boundary
Instead of serializing the event, create anexplicit mapping from event to span: a small piece of code that defines whatcrosses the boundary, what it's called, and what shape it takes.
public static classOrderTelemetry
{
public static voidProjectToSpan(OrderPlaced e, Activity? activity)
{
if (activity isnull) return;
// Allowlist: onlythese fields cross the boundary
activity.SetTag("order.type", e.OrderType);
activity.SetTag("order.channel", e.Channel);
activity.SetTag("tenant.id", e.Tenant);
// Bucketed:bounded cardinality instead of a raw amount
activity.SetTag("order.value_band", ValueBand(e.Value));
}
}
Three things make this more than a namingexercise:
- An allow list, not a serializer. A new field on the event won't show up in your telemetry until someone deliberately chooses to include it.
- Telemetry names of their own. order.type is not orderType, sorenaming a domain field doesn't ripple through to your dashboards.
- The mapping is code. It's versioned withthe producer and covered by a contract test, so the 3 a.m. break becomes afailing build instead.
Same discipline, two angles
Good event design and good observability arereally the same discipline, viewed from two angles. Business events are richbecause you've modeled the domain truthfully. That richness is precisely whatmakes them useful in a trace.
But rich is not the same as relevant. Whatgoes into telemetry should be a deliberate decision, not a side effect.
Project, don't pour. Want to get more out of your telemetry without leaking personal data or blowing upstorage costs? Don't hesitate to reach out.
Let'scurate your observability strategy.
