-
Notifications
You must be signed in to change notification settings - Fork 217
fix: Capture correct descriptions for RSpec one-liner examples #1712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: Capture correct descriptions for RSpec one-liner examples #1712
Conversation
RSpec one-liner examples (e.g., `it { is_expected.not_to be_nil }`) generate descriptions after execution. Updated formatter to capture the final description in `example_finished` instead of relying on the incomplete description at `example_started`.
## Why? Span names and full descriptions for RSpec one-liner syntax (like `it { is_expected.not_to be_nil }`) were incorrectly showing file locations instead of the matcher-generated descriptions. This made tracing output less useful for tests using the concise one-liner syntax. ## How? RSpec generates descriptions for one-liner examples after execution, when the matcher runs. The formatter was capturing `description` and `full_description` at `example_started` time, before these values were populated. The fix updates both the span name and `full_description` attribute in the `example_finished` callback, after RSpec has generated the proper description from the matcher. This ensures accurate span names and descriptions for both one-liner and traditional examples. We need to point Intercom's Gemfile to this repo so that we get those updates without waiting for the upstream repo to accept them. --- **Note:** Upstream PR created at open-telemetry#1712
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @americodls, thanks for catching this and providing a fix!
## Why? Span names and full descriptions for RSpec one-liner syntax (like `it { is_expected.not_to be_nil }`) were incorrectly showing file locations instead of the matcher-generated descriptions. This made tracing output less useful for tests using the concise one-liner syntax. ## How? RSpec generates descriptions for one-liner examples after execution, when the matcher runs. The formatter was capturing `description` and `full_description` at `example_started` time, before these values were populated. The fix updates both the span name and `full_description` attribute in the `example_finished` callback, after RSpec has generated the proper description from the matcher. This ensures accurate span names and descriptions for both one-liner and traditional examples. We need to point Intercom's Gemfile to this repo so that we get those updates without waiting for the upstream repo to accept them. --- **Note:** Upstream PR created at open-telemetry#1712
@chrisholmes may I ask for a review please? |
I'm away from computer so I can't test it myself, but the change is simple enough and it makes sense to me. |
Please review at your leisure. With your approval I will merge this PR. |
## Why? Span names and full descriptions for RSpec one-liner syntax (like `it { is_expected.not_to be_nil }`) were incorrectly showing file locations instead of the matcher-generated descriptions. This made tracing output less useful for tests using the concise one-liner syntax. ## How? RSpec generates descriptions for one-liner examples after execution, when the matcher runs. The formatter was capturing `description` and `full_description` at `example_started` time, before these values were populated. The fix updates both the span name and `full_description` attribute in the `example_finished` callback, after RSpec has generated the proper description from the matcher. This ensures accurate span names and descriptions for both one-liner and traditional examples. We need to point Intercom's Gemfile to this repo so that we get those updates without waiting for the upstream repo to accept them. --- **Note:** Upstream PR created at open-telemetry#1712
## Why? Span names and full descriptions for RSpec one-liner syntax (like `it { is_expected.not_to be_nil }`) were incorrectly showing file locations instead of the matcher-generated descriptions. This made tracing output less useful for tests using the concise one-liner syntax. ## How? RSpec generates descriptions for one-liner examples after execution, when the matcher runs. The formatter was capturing `description` and `full_description` at `example_started` time, before these values were populated. The fix updates both the span name and `full_description` attribute in the `example_finished` callback, after RSpec has generated the proper description from the matcher. This ensures accurate span names and descriptions for both one-liner and traditional examples. We need to point Intercom's Gemfile to this repo so that we get those updates without waiting for the upstream repo to accept them. --- **Note:** Upstream PR created at open-telemetry#1712
RSpec one-liner examples (e.g.,
it { is_expected.not_to be_nil }
) generate descriptions after execution.Updated formatter to capture the final description in
example_finished
instead of relying on the incomplete description atexample_started
.