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

[OpenTelemetry] http.route server span attribute set to "/" #45684

Open
PhilippParis opened this issue Jan 17, 2025 · 5 comments
Open

[OpenTelemetry] http.route server span attribute set to "/" #45684

PhilippParis opened this issue Jan 17, 2025 · 5 comments

Comments

@PhilippParis
Copy link

Describe the bug

when defining the JAX-RS annotations in an interface (e.g. generated by the openapi-generator) the OpenTelemetry server span attribute http.route
is set to "/" instead of the actual route.

the issue is also mentioned here: #27827 (comment)

http.route is used in some tools (e.g. graphana) to display the trace name.
Due to the bug, all traces have the same name: e.g "POST /"

Expected behavior

http.route set to "/path/to/resource"

Server Span Attributes:

client.address:  "127.0.0.1" 
code.function: "endpoint"  
code.namespace: "com.example.com.Resource" 
http.request.body.size: 0   
http.request.method:  "POST"  
http.response.status_code: 204   
http.route: "/path/to/resource"   
server.address: "localhost"  
server.port: 8080 
url.path: "/example/api/v1/path/to/resource"   
url.scheme: "http" 
user_agent.original: "bruno-runtime/1.34.0"

Actual behavior

http.route set to "/"

Server Span Attributes:

client.address:  "127.0.0.1" 
code.function: "endpoint"  
code.namespace: "com.example.com.Resource" 
http.request.body.size: 0   
http.request.method:  "POST"  
http.response.status_code: 204   
http.route: "/"   
server.address: "localhost"  
server.port: 8080 
url.path: "/example/api/v1/path/to/resource"   
url.scheme: "http" 
user_agent.original: "bruno-runtime/1.34.0"

How to Reproduce?

public interface ResourceInterface {
    @POST
    Response endpoint();
}


@Path("/path/to/resource")
@ApplicationScoped
public class Resource implements ResourceInterface {

    public Response endpoint() {
        return Response.noContent().build();
    }
}

Output of uname -a or ver

No response

Output of java -version

openjdk 21.0.3

Quarkus version or git rev

3.17.7

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.8

Additional information

No response

@PhilippParis PhilippParis added the kind/bug Something isn't working label Jan 17, 2025
Copy link

quarkus-bot bot commented Jan 17, 2025

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)

@PhilippParis PhilippParis changed the title [OpenTelemetry] http.route server span attribute set to "/" when using interfaces [OpenTelemetry] http.route server span attribute set to "/" Jan 17, 2025
@gsmet
Copy link
Member

gsmet commented Jan 17, 2025

Could you please provide a simple reproducer in the form of a Maven project? Thanks!

@brunobat
Copy link
Contributor

It's a bit strange to split JAX-RS annotations between interface and implementation. In theory it's possible but it looks wrong.
Can you please try:

public interface ResourceInterface {
    @POST
    @Path("/path/to/resource")
    Response endpoint();
}

@PhilippParis
Copy link
Author

here is a reproducer project: https://github.com/PhilippParis/otel-issue-reproducer

issue can be reproduced by executing "curl localhost:8080/api/v1/hello"
and checking the traces in the graphana dev service

in setting up the reproducer i discovered that the issue is only present when using the resteasy dependencies.
when using "quarkus-rest-jackson" or "quarkus-rest" it works as expected!

so i guess should really migrate my projects to quarkus-rest!
if you are not planning to fix that in the old resteasy dependencies, feel free to close the issue.

thanks for your quick feedback!

@geoand
Copy link
Contributor

geoand commented Jan 17, 2025

so i guess should really migrate my projects to quarkus-rest!

That should probably be done regardless of this issue (which we should fix in any case) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

4 participants