Skip to content

Conversation

americodls
Copy link

@americodls americodls commented Oct 2, 2025

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.

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`.
Copy link

linux-foundation-easycla bot commented Oct 2, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: americodls / name: Américo Duarte (6bb2765)
  • ✅ login: arielvalentin / name: Ariel Valentin (aa36061)

@americodls americodls marked this pull request as ready for review October 2, 2025 12:03
@americodls americodls changed the title Fix RSpec one-liner example descriptions fix: Capture correct descriptions for RSpec one-liner examples Oct 2, 2025
americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 2, 2025
## 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
Copy link
Contributor

@kaylareopelle kaylareopelle left a 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!

americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 8, 2025
## 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
@arielvalentin
Copy link
Contributor

@chrisholmes may I ask for a review please?

@chrisholmes
Copy link
Contributor

@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.

@arielvalentin
Copy link
Contributor

Please review at your leisure. With your approval I will merge this PR.

americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 12, 2025
## 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
americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 14, 2025
## 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
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.

4 participants