Skip to content
← Back to activity

Immutable solution version

meta.span_count counts span events and links, not just spans

Version 2Sign in to save

Complete solution

Shows how to fix meta.span_count counts span events and links, not just spans. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Issue honeycombio/refinery#555 (closed, 8 comments): with AddSpanCountToRoot enabled, meta.span_count included span annotations and links, so sampling rules keyed on trace size misfired.

Steps

  1. Issue honeycombio/refinery#555 (closed, 8 comments): with AddSpanCountToRoot enabled, meta.span_count included span annotations and links, so sampling rules keyed on trace size misfired. Maintainers explained the value deliberately counted every child of the root span, but agreed the naming was misleading. They added a new AddCountsToRoot config that replaces AddSpanCountToRoot and records separate counts for spans, span events, span links, and the total.
  2. If you use Refinery's AddSpanCountToRoot and meta.spancount looks too high, that is by design: it counts every child of the root span, including span events and span links, not just spans. For separate numbers, set AddCountsToRoot to true instead. That config overrides AddSpanCountToRoot and records meta.spancount (spans only), meta.spaneventcount, meta.spanlinkcount, and meta.event_count (the sum). Dont set both and expect validation to complain; when both are present, AddCountsToRoot simply wins.

When to use

You are seeing this: Maintainers explained the value deliberately counted every child of the root span, but agreed the naming was misleading. Use this skill when you run into "meta.span_count counts span events and links, not just spans".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In the GitHub issue gh:honeycombio/refinery#555 (https://github.com/honeycombio/refinery/issues/555), the problem reported was: Issue honeycombio/refinery#555 (closed, 8 comments): with AddSpanCountToRoot enabled, meta.spancount included span annotations and links, so sampling rules keyed on trace size misfired. Maintainers explained the value deliberately counted every child of the root span, but agreed the naming was misleading. They added a new AddCountsToRoot config that replaces AddSpanCountToRoot and records separate counts for spans, span events, span links, and the total. The verified resolution was: If you use Refinery's AddSpanCountToRoot and meta.spancount looks too high, that is by design: it counts every child of the root span, including span events and span links, not just spans. For separate numbers, set AddCountsToRoot to true instead. That config overrides AddSpanCountToRoot and records meta.spancount (spans only), meta.spaneventcount, meta.spanlinkcount, and meta.eventcount (the sum). Dont set both and expect validation to complain; when both are present, AddCountsToRoot simply wins.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_z_o0bQ4aCYiqwi_B3nu3OA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">meta.span_count counts span events and links, not just spans <span>— Vectle</span></a>