Skip to content

Conversation

americodls
Copy link

This PR adds RSpec's example.id as a span attribute to provide unique identification for each test example.

The existing rspec.example.location attribute cannot uniquely identify dynamically generated examples (e.g., examples created within loops or using data tables) because multiple examples share the same source file location. RSpec's example.id provides a stable, unique identifier across test runs even for these dynamic cases.

Example format: ./spec/foo_spec.rb[1:2:3]

This enables better correlation and tracking of individual test executions in observability platforms.

Record RSpec's example.id as a span attribute to provide unique identification for each test example. This is particularly valuable when examples are created dynamically (e.g., within loops), where multiple examples share the same file location but have distinct IDs.
@americodls americodls force-pushed the ad/add-example-id-attribute branch 3 times, most recently from b2abd9b to 966e985 Compare October 2, 2025 13:41
americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 2, 2025
This PR adds RSpec's `example.id` as a span attribute to provide unique
identification for each test example.

The existing `rspec.example.location` attribute cannot uniquely identify
dynamically generated examples (e.g., examples created within loops or
using data tables) because multiple examples share the same source file
location. RSpec's `example.id` provides a stable, unique identifier
across test runs even for these dynamic cases.

Example format: `./spec/foo_spec.rb[1:2:3]`

This enables better correlation and tracking of individual test
executions in observability platforms.

---

Upstream PR:
open-telemetry#1713
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.

Thanks for your contribution, @americodls. This makes sense to me. I'll leave it open for a few more days to see if any of the other approvers/maintainers have feedback.

americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 8, 2025
This PR adds RSpec's `example.id` as a span attribute to provide unique
identification for each test example.

The existing `rspec.example.location` attribute cannot uniquely identify
dynamically generated examples (e.g., examples created within loops or
using data tables) because multiple examples share the same source file
location. RSpec's `example.id` provides a stable, unique identifier
across test runs even for these dynamic cases.

Example format: `./spec/foo_spec.rb[1:2:3]`

This enables better correlation and tracking of individual test
executions in observability platforms.

---

Upstream PR:
open-telemetry#1713
@arielvalentin
Copy link
Contributor

@chrisholmes may I please have a review here?

americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 12, 2025
This PR adds RSpec's `example.id` as a span attribute to provide unique
identification for each test example.

The existing `rspec.example.location` attribute cannot uniquely identify
dynamically generated examples (e.g., examples created within loops or
using data tables) because multiple examples share the same source file
location. RSpec's `example.id` provides a stable, unique identifier
across test runs even for these dynamic cases.

Example format: `./spec/foo_spec.rb[1:2:3]`

This enables better correlation and tracking of individual test
executions in observability platforms.

---

Upstream PR:
open-telemetry#1713
americodls added a commit to intercom/opentelemetry-ruby-contrib that referenced this pull request Oct 14, 2025
This PR adds RSpec's `example.id` as a span attribute to provide unique
identification for each test example.

The existing `rspec.example.location` attribute cannot uniquely identify
dynamically generated examples (e.g., examples created within loops or
using data tables) because multiple examples share the same source file
location. RSpec's `example.id` provides a stable, unique identifier
across test runs even for these dynamic cases.

Example format: `./spec/foo_spec.rb[1:2:3]`

This enables better correlation and tracking of individual test
executions in observability platforms.

---

Upstream PR:
open-telemetry#1713
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.

3 participants