Skip to content

Allow generic span consumer implementations#9

Merged
TheJokr merged 3 commits into
masterfrom
lblocher/generic-consumer
Apr 8, 2026
Merged

Allow generic span consumer implementations#9
TheJokr merged 3 commits into
masterfrom
lblocher/generic-consumer

Conversation

@TheJokr

@TheJokr TheJokr commented Apr 7, 2026

Copy link
Copy Markdown

rustracing previously forced users to consume finished spans via a tokio
mpsc channel. In some cases a different type of consumer is required
(such as a multi-consumer queue), so we want to make this part of
rustracing generic.

This adds a dynamic dispatch to each Span::drop call, but it should be
easy to predict since generally there is only a single Tracer per
application. Adding a span into a queue for consumption is also
typically much higher overhead than a dynamic dispatch.

The change is intended to be backwards compatible, but adds a new trait
bound to Tracer: T must be Send + 'static. In theory a
single-threaded application would not have required this before, but in
practice every implementation should fulfill these bounds.

Includes a release commit for cf-rustracing 1.3.0

@TheJokr TheJokr self-assigned this Apr 7, 2026
@TheJokr TheJokr requested a review from fisherdarling April 7, 2026 17:25
rustracing previously forced users to consume finished spans via a tokio
mpsc channel. In some cases a different type of consumer is required
(such as a multi-consumer queue), so we want to make this part of
rustracing generic.

This adds a dynamic dispatch to each `Span::drop` call, but it should be
easy to predict since generally there is only a single `Tracer` per
application. Adding a span into a queue for consumption is also
typically much higher overhead than a dynamic dispatch.

The change is intended to be backwards compatible, but adds a new trait
bound to `Tracer`: `T` must be `Send + 'static`. In theory a
single-threaded application would not have required this before, but in
practice every implementation should fulfill these bounds.
@TheJokr TheJokr force-pushed the lblocher/generic-consumer branch from fd4604d to 9a03425 Compare April 7, 2026 17:26
@TheJokr TheJokr merged commit bbc5694 into master Apr 8, 2026
8 checks passed
@TheJokr TheJokr deleted the lblocher/generic-consumer branch April 8, 2026 09:41
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.

2 participants