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

Transaction Name Incorrect with PATCH Verbs using Jersey #1893

Closed
wdemis opened this issue May 15, 2024 · 3 comments
Closed

Transaction Name Incorrect with PATCH Verbs using Jersey #1893

wdemis opened this issue May 15, 2024 · 3 comments
Labels
bug Something isn't working as designed/intended wontfix Issue will not be worked on

Comments

@wdemis
Copy link

wdemis commented May 15, 2024

Transaction name does not seem to be set properly for PATCH requests when using Jersey

Description

We noticed that GET, PUT, POST, DELETE web request verbs will cause NewRelic to generate transactions with "name" set to: WebTransaction/RestWebService/v1/actions/{actionId} (GET) however the PATCH requests are being set to: WebTransaction/Servlet/jersey

Expected Behavior

The expectation is that all web requests return a consistent transaction name. For PATCH requests, we'd expect it to look similar to the other requests. In our case: WebTransaction/RestWebService/v1/actions/{actionId} (PATCH)

Troubleshooting

We setup two basic web request handlers in a controller. We setup NewRelic to run locally so that we could monitor the logs while debugging. Controller code was:

    @GET
    @Path("test/me")
    @Trace(metricName = "Endpoint - get")
    public Response testGet() {
        return Response.ok().entity(Map.of("result", "foo")).build();
    }

    @PATCH
    @Path("test/me")
    @Trace(metricName = "Endpoint - patch")
    public Response testPatch() {
        return Response.ok().entity(Map.of("result", "foo")).build();
    }

Hitting both endpoints produces the following logs:

PATCH <--------------
2024-05-14T14:59:44,695-0400 [7928 1] com.newrelic FINER: Setting transaction name to "Java/org.glassfish.jersey.servlet.ServletContainer/init" for transaction com.newrelic.agent.Transaction@a8f1719
2024-05-14T15:00:35,832-0400 [7928 464] com.newrelic FINER: Setting transaction name using filter name: characterEncodingFilter
2024-05-14T15:00:35,832-0400 [7928 464] com.newrelic FINER: Setting transaction name to "characterEncodingFilter" for transaction com.newrelic.agent.Transaction@5d82b511
2024-05-14T15:00:35,833-0400 [7928 464] com.newrelic FINER: Setting transaction name using filter name: formContentFilter
2024-05-14T15:00:35,833-0400 [7928 464] com.newrelic FINER: Setting transaction name using filter name: requestContextFilter
2024-05-14T15:00:35,836-0400 [7928 464] com.newrelic FINER: Setting transaction name using filter name: springLoggingFilter
2024-05-14T15:00:35,837-0400 [7928 464] com.newrelic FINER: Setting transaction name using filter name: healthCheckFilter
2024-05-14T15:00:35,837-0400 [7928 464] com.newrelic FINER: Setting transaction name using servlet name: jersey
2024-05-14T15:00:35,837-0400 [7928 464] com.newrelic FINER: Setting transaction name to "jersey" for transaction com.newrelic.agent.Transaction@5d82b511


GET <--------------
2024-05-14T15:00:45,409-0400 [7928 465] com.newrelic FINER: Setting transaction name using filter name: characterEncodingFilter
2024-05-14T15:00:45,409-0400 [7928 465] com.newrelic FINER: Setting transaction name to "characterEncodingFilter" for transaction com.newrelic.agent.Transaction@62eaec05
2024-05-14T15:00:45,409-0400 [7928 465] com.newrelic FINER: Setting transaction name using filter name: formContentFilter
2024-05-14T15:00:45,410-0400 [7928 465] com.newrelic FINER: Setting transaction name using filter name: requestContextFilter
2024-05-14T15:00:45,410-0400 [7928 465] com.newrelic FINER: Setting transaction name using filter name: springLoggingFilter
2024-05-14T15:00:45,410-0400 [7928 465] com.newrelic FINER: Setting transaction name using filter name: healthCheckFilter
2024-05-14T15:00:45,410-0400 [7928 465] com.newrelic FINER: Setting transaction name using servlet name: jersey
2024-05-14T15:00:45,410-0400 [7928 465] com.newrelic FINER: Setting transaction name to "jersey" for transaction com.newrelic.agent.Transaction@62eaec05
2024-05-14T15:00:45,414-0400 [7928 465] com.newrelic FINER: Setting transaction name to "/v1/actions/test/me (GET)" for transaction com.newrelic.agent.Transaction@62eaec05

Steps to Reproduce

Create a jersey controller with a PATCH request handler. Hit endpoint and check NewRelic logs or Transactions table for transaction name.

Your Environment

  • Jersey: 2.35
  • NewRelic Java Agent: 8.2.0 (We have also tested with NR Agent version 8.9.1 and 8.11.1 which all produce the exact same results)
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>2.35</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.newrelic.agent.java</groupId>
                <artifactId>newrelic-api</artifactId>
                <version>8.2.0</version>
            </dependency>

Additional context

This resolved issue sure seems very similar; perhaps this was addressed for Spring and not Jersey?

@wdemis wdemis added the bug Something isn't working as designed/intended label May 15, 2024
@workato-integration
Copy link

@jtduffy
Copy link
Contributor

jtduffy commented May 15, 2024

Hi @wdemis
I tried to repro the issue using the attached sample Jersey app (created from the maven archetype -DarchetypeArtifactId=jersey-quickstart-grizzly2) and the PATCH method was reporting properly as WebTransaction/RestWebService/myresource (PATCH)

Can you provide a simple repro? There's obviously something different in your project that's not part of my simple app. Thanks!
simple-service.zip

@kford-newrelic kford-newrelic added the wontfix Issue will not be worked on label Jun 4, 2024
@kford-newrelic
Copy link
Contributor

Closing. We'll need to have a viable repro app in order to investigate this further.

@kford-newrelic kford-newrelic closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as designed/intended wontfix Issue will not be worked on
Projects
Status: Code Complete/Done
Development

No branches or pull requests

3 participants