Span or Attribute in OpenTelemetry Custom Instrumentation
7 similar posts
- OpenTelemetry
- Honeycomb
AI Summary
When adding custom instrumentation in OpenTelemetry, developers often debate whether to use spans, attributes, or logs. This article argues that attributes on existing spans are generally best because they provide strong correlation power at a lower cost, while distinct spans should be reserved for major units of work, network boundaries, async boundaries, and performance profiling.
Key Takeaways
- Attributes on top-level spans allow correlation of user IDs, feature flags, and request properties with errors or latency.
- New spans should represent distinct units of work, network boundaries, or async operations.
- Logs or span events should be used for recurring events or exceptions that might overwrite single-valued span attributes.
Why it matters
Choosing the correct telemetry primitive ensures observability data is cheap to store, fast to query, and accurately represents application behavior without cluttering trace waterfalls.
Conversation0
What would you add from your experience?
Checking your session…
Every good conversation starts with one perspective.