live-check: validate span names against span name templates
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:
- 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 aspan_name_mismatchfinding next tokind_mismatch, withexpectedandactualin the context. If no template applies, or the definition has none, skip the check. - Matchers can target span refinements. Today
signalresolves against base span types only. Refinements can overridename(and attributes), e.g.gen_ai.execute_tool.load_skill.internalusesexecute_tool {gen_ai.tool.name} {gen_ai.skill.name}. Without this, refined spans get checked against the base template and flagged. Proposal: letsignalalso 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.
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 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.