Skip to content

Conversation

@hds
Copy link
Contributor

@hds hds commented Oct 3, 2024

Motivation

Previously there were two separate implementations which would check an
ExpectedSpan against and actual span. One on the ExpectedSpan struct
itself, which took a SpanState as used by the MockCollector and
another on the MockSubscriber which took a SpanRef (from
tracing-subscriber).

In reality, both of these checks needed a span::Id and a Metadata to
check, but the structure was also somewhat different, with the
MockSubscriber span check giving better error output.

Solution

This change combines the two checks into the one on ExpectedSpan,
which is now generic over an ActualSpan implementation, which has been
provided for SpanState, SpanRef, and also span::Id (for the case
where no Metadata is available).

The better error output from MockSubscriber has been integrated into
that check.

@hds hds requested review from a team, davidbarsky and hawkw as code owners October 3, 2024 13:05
Previously there were two separate implementations which would check an
`ExpectedSpan` against and actual span. One on the `ExpectedSpan` struct
itself, which took a `SpanState` as used by the `MockCollector` and
another on the `MockSubscriber` which took a `SpanRef` (from
`tracing-subscriber`).

In reality, both of these checks needed a `span::Id` and a `Metadata` to
check, but the structure was also somewhat different, with the
`MockSubscriber` span check giving better error output.

This change combines the two checks into the one on `ExpectedSpan`,
which is now generic over an `ActualSpan` implementation, which has been
provided for `SpanState`, `SpanRef`, and also `span::Id` (for the case
where no `Metadata` is available).

The better error output from `MockSubscriber` has been integrated into
that check.
@hds hds force-pushed the hds/mock-expected-span-check branch from 935bbe0 to 1da4c31 Compare October 3, 2024 13:35
@hds
Copy link
Contributor Author

hds commented Oct 4, 2024

This change has been merged into #3098 and modified significantly.

@hds hds closed this Oct 4, 2024
@jplatte jplatte deleted the hds/mock-expected-span-check branch June 3, 2025 09:15
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