Skip to content
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

Internal span name is being overridden by opentelemetry-javaagent #10278

Closed
shaykeren opened this issue Jan 18, 2024 · 4 comments · Fixed by #10290
Closed

Internal span name is being overridden by opentelemetry-javaagent #10278

shaykeren opened this issue Jan 18, 2024 · 4 comments · Fixed by #10290
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@shaykeren
Copy link

shaykeren commented Jan 18, 2024

Describe the bug

using spring-petclinic application and run testInitCreationForm test (WebMvcTest) I found out that the span name I created in the test was overridden with the name "GET /owners/new"

Running WebMvcTest test using the following configuration:
JAVA_TOOL_OPTIONS: -javaagent:/opentelemetry-javaagent.jar
-Dotel.exporter.otlp.traces.endpoint=ObservabilityURL
-Dotel.javaagent.experimental.field-injection.enabled=false
-Dotel.traces.exporter=otlp
-Dotel.metrics.exporter=none
-Dotel.instrumentation.experimental.span-suppression-strategy=none
-Dotel.service.name=spring-petclinic

using opentelemetry-javaagent - version: 1.32.0

Steps to reproduce

  1. use spring-petclinic repository
  2. modify test name "testInitCreationForm" and add @WithSpan() annotation
@WithSpan()
@Test
void testInitCreationForm() throws Exception {
       mockMvc.perform(get("/owners/new"))
	.andExpect(status().isOk())
	.andExpect(model().attributeExists("owner"))
	.andExpect(view().name("owners/createOrUpdateOwnerForm"));
}

  1. run test with the following configuration:
    test using the following configuration:
    JAVA_TOOL_OPTIONS: -javaagent:/opentelemetry-javaagent.jar
    -Dotel.exporter.otlp.traces.endpoint=ObservabilityURL
    -Dotel.javaagent.experimental.field-injection.enabled=false
    -Dotel.traces.exporter=otlp
    -Dotel.metrics.exporter=none
    -Dotel.instrumentation.experimental.span-suppression-strategy=none
    -Dotel.service.name=spring-petclinic

And observe the following trace:
the span name was overridden with the name "GET /owners/new"
image

Expected behavior

my span name should not be changed

Actual behavior

span name changed to: GET /owners/new

Javaagent or library instrumentation version

1.32.0

Environment

:: Built with Spring Boot :: 3.2.0
Java 17.0.7
macos

Additional context

No response

@shaykeren shaykeren added bug Something isn't working needs triage New issue that requires triage labels Jan 18, 2024
@shaykeren shaykeren changed the title My internal span name is being overridden by opentelemetry-javaagent Internal span name is being overridden by opentelemetry-javaagent Jan 18, 2024
@laurit
Copy link
Contributor

laurit commented Jan 18, 2024

My guess is that the issue is in


we update the name on the root span regardless of whether it is a server or internal span. I guess we could change it to update only server spans.

@doppleware
Copy link

Hey guys anything we can do to help with this one?

@trask
Copy link
Member

trask commented Feb 6, 2024

@laurit submitted a fix for this already (linked above). If you are able to build a snapshot from the PR branch and verify it resolves your issue that could be helpful.

@doppleware
Copy link

Hey - I can confirm this works, thank you :) Is it possible to merge it to a stable release as well on the next minor/patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants