Skip to content

Conversation

@robertlaurin
Copy link
Contributor

span.name is not a method on api/non recording spans. This small refactor changes the logic around renaming to stop relying on the presence of span.name for when the naming convention is class_name.

Adds a small regression test to prevent this mistake from being re-introduced.

# If there is an exception we want to keep the original span name
# so it is easier to see where the request was routed to.
elsif request.env['action_dispatch.exception']
span.name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API spans have a setter, but not a getter for name.

span = OpenTelemetry::Instrumentation::Rack.current_span
span_name = if @span_naming == :semconv
if http_route
if @span_naming == :semconv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we skip this entire logic unless span.recording??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good improvement to make. Pushed up that change.

@fbogsany
Copy link
Contributor

span.name is not a method on api/non recording spans

Technically, it is incorrect to use it for SDK spans too, other than in span processors.

@robertlaurin robertlaurin merged commit 6703511 into open-telemetry:main Jun 16, 2025
58 of 62 checks passed
@robertlaurin robertlaurin deleted the fix-sdk-span-dep branch June 16, 2025 20:07
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