weaver icon indicating copy to clipboard operation
weaver copied to clipboard

live-check: validate span names against span name templates

Open lmolkova opened this issue 1 month ago • 2 comments

Span name templates (#1763) are resolved and validated at load time, but live-check doesn't use them yet. docs/specs/span-naming/span_naming.md section 4 lists this as planned.

Live-check already knows which definition a span follows when a matcher sets signal, and the type advisor checks attributes and kind against it. Proposal:

  1. Name check. When a span is matched to a definition that has name.templates, pick the first template whose attributes are all present, non-empty and not _OTHER (for enums). Render it and compare the result with the span name. On mismatch, emit a span_name_mismatch finding next to kind_mismatch, with expected and actual in the context. If no template applies, or the definition has none, skip the check.
  2. Matchers can target span refinements. Today signal resolves against base span types only. Refinements can override name (and attributes), e.g. gen_ai.execute_tool.load_skill.internal uses execute_tool {gen_ai.tool.name} {gen_ai.skill.name}. Without this, refined spans get checked against the base template and flagged. Proposal: let signal also resolve to a span refinement id.

Once spans carry their type (#1851), the same check applies to typed spans without a matcher.

Context: semantic-conventions-conformance implements this check in rego today (open-telemetry/semantic-conventions-conformance#399) and would drop that once weaver supports it.

lmolkova avatar Oct 26 '26 19:10 lmolkova

I'd like to contribute this live-check follow-up. I'd cover template selection, expected/actual name mismatch findings, and matcher resolution for span refinements, including cases where no template applies. Please let me know if the proposed scope needs adjustment before implementation.

Disclosure: Codex assisted with finding this issue and drafting this comment.

adityamukesh avatar Oct 28 '26 14:10 adityamukesh

@adityamukesh awesome, do you want to send a PR?

Let's start with span name check and consider separating matching span refinements into a different PR.

lmolkova avatar Oct 31 '26 02:10 lmolkova