Skip to content

feat: add_link and with_link#161

Merged
andylokandy merged 6 commits intofast:mainfrom
andylokandy:dev-2
Feb 23, 2026
Merged

feat: add_link and with_link#161
andylokandy merged 6 commits intofast:mainfrom
andylokandy:dev-2

Conversation

@andylokandy
Copy link
Collaborator

@andylokandy andylokandy commented Feb 1, 2026

Resolves #148

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for span links to the fastrace library, resolving issue #148. Span links allow spans to reference other spans without establishing strict parent-child relationships, which is a standard feature in OpenTelemetry.

Changes:

  • Adds with_link() and add_link() methods to both Span and LocalSpan APIs for adding span links
  • Deprecates enter_with_parents() method, converting multi-parent functionality to use the first parent with additional parents as links
  • Refactors internal architecture: changes CollectToken from Vec<CollectTokenItem> to a single struct, and changes properties field from Option<Vec> to Vec directly

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fastrace/src/span.rs Adds with_link and add_link methods, deprecates enter_with_parents, refactors CollectToken usage
fastrace/src/local/local_span.rs Adds with_link and add_link methods for LocalSpan
fastrace/src/local/raw_span.rs Adds links field, changes properties to non-optional, derives Clone
fastrace/src/collector/mod.rs Adds links field to SpanRecord, refactors CollectToken to single struct
fastrace/src/collector/global_collector.rs Adds Link handling in DanglingItem enum and processing logic
fastrace/src/collector/id.rs Adds PartialEq and Eq derives to SpanContext for test assertions
fastrace-opentelemetry/src/lib.rs Adds map_links function to convert fastrace links to OpenTelemetry format
fastrace/src/local/span_queue.rs Adds add_link and with_link methods
fastrace/src/local/local_span_line.rs Adds link handling methods, refactors token handling
fastrace/src/local/local_span_stack.rs Adds link handling methods
fastrace/src/util/tree.rs Updates to use single CollectToken instead of Vec
fastrace/src/util/mod.rs Removes CollectToken type alias (moved to collector module)
fastrace/src/event.rs Changes properties to non-optional, fixes doc example
fastrace/tests/lib.rs Adds tests for span links, removes deprecated multi-parent test
tests/statically-disable/src/main.rs Updates test to use new link APIs
examples/synchronous.rs Updates to use with_properties instead of with_property
examples/asynchronous.rs Updates to use with_properties instead of with_property

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andylokandy andylokandy merged commit bba223d into fast:main Feb 23, 2026
11 checks passed
@andylokandy andylokandy deleted the dev-2 branch February 23, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support span links in the OpenTelemetry reporter

2 participants