Home / Companies / Honeycomb / Blog / Post Details
Content Deep Dive

startSpan vs. startActiveSpan

Blog post from Honeycomb

Post Details
Company
Date Published
Author
Jessica Kerr (Jessitron)
Word Count
588
Company Posts That Month
8
Language
English
Hacker News Points
-
Post removed?
No
Summary

In instrumenting a Node.js application with OpenTelemetry, the choice between `startSpan` and `startActiveSpan` is crucial depending on the desired span hierarchy and expressiveness. `startSpan` is simpler and measures the duration of a task without creating any child spans, meaning it shares the same parent with any concurrent spans. Conversely, `startActiveSpan` requires passing a callback function, which allows the created span to act as a parent to any subsequent spans generated during its execution. This approach provides a clearer hierarchical structure in tracing tools like Honeycomb, where the relationships between activities, such as checking a cache or executing an HTTP GET, are visually represented. Although `startActiveSpan` involves more complexity due to the callback requirement, it offers a more detailed and organized trace, reflecting the causal relationships between tasks and spans.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.