feat: support attributes on span links#227
Merged
Merged
Conversation
Extend the link DSL to accept an optional attributes map alongside the existing bare-string ref form. Attributes are plumbed through LinkConfig → OperationConfig → Link (topology) → LinkRef (plan) → trace.Link.Attributes so they appear on every emitted OTel span link. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> Claude-Session: https://claude.ai/code/session_01FBAoX4p3qC5NnVg9fGhRiR
Span link attributes were stored as map[string]string, which made the new structured link form inconsistent with the rest of the topology DSL and flattened numeric or boolean values before they reached trace.Link. Reuse AttributeValueConfig and resolved Attributes for links so validation, deterministic key ordering, and typed attribute generation follow the existing operation, event, metric, and log path. Apply the same generated attribute.KeyValue values in walkTrace and realtime SpanPlan emission. Update the span links example to use the established attribute value syntax and cover typed link attributes in config, topology, plan, emit, and engine tests.
Owner
Author
|
Adversarial review finding and patch pushed.
Patch pushed to this branch:
Validation run:
Remaining note: I did not treat semconv-aware validation as a blocker in this patch because motel does not currently warn on ordinary span attributes through that path; adding link-only semconv behavior would be inconsistent and should be a separate policy decision if we want it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #215
LinkConfigstruct with custom YAML unmarshaling so links accept both bare-string (- producer.enqueue) and structured form (- ref: producer.enqueue \n attributes: ...)LinkConfig→OperationConfig→Link(topology) →LinkRef(plan) →trace.Link.Attributesin bothengine.go(walkTrace) andemit.go(realtime mode)docs/examples/span-links.yamlto show the structured form with attributesTestParseLinkConfig(YAML round-trip for both forms) andTestEngineSpanLinkAttributes(attributes appear on emitted spans)Test plan
go test ./pkg/synth/...— all existing tests pass, new tests cover both DSL forms and attribute propagationdocs/examples/span-links.yamlparses and emits correctly with link attributes🤖 Generated with Claude Code
https://claude.ai/code/session_01FBAoX4p3qC5NnVg9fGhRiR
Generated by Claude Code