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

Support multiple values in Spring @RequestMapping annotations #2229

Open
jtduffy opened this issue Feb 3, 2025 · 1 comment
Open

Support multiple values in Spring @RequestMapping annotations #2229

jtduffy opened this issue Feb 3, 2025 · 1 comment

Comments

@jtduffy
Copy link
Contributor

jtduffy commented Feb 3, 2025

Description

Currently, if a Spring @RequestMapping/@GetMapping/etc annotations have multiple entries in their value attribute, the agent will only use the first value element to name the transaction. For example:

@RequestMapping(value = {
        "threadData/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}",
        "threadData/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}/{optionalBlobId}",
        "threadData/accounts/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}",
        "threadData/accounts/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}/{optionalBlobId}"},
        method = RequestMethod.GET, produces = "application/json")

Regardless of the URL pattern used to invoke this controller method, the transaction name will always be:
threadData/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}

The agent should implement logic to match the underlying, concrete URL to the correct mapping value if more than one value pattern is present. In the above example, the URL threadData/accounts/1234/abcdef/0987654/qwerty/asdfg/zxcvbn would map to threadData/accounts/{accountId}/{clusterAgentId}/{fingerprint}/{buildUuid}/{occurrenceUuid}/{optionalBlobId} (match on two constant URL parts and 6 variable parts).

Internal Slack thread.

Acceptance Criteria

Spring WebMVC based transactions are named properly when multiple URL patterns are present in the value attribute of the mapping annotation.

Design Consideration/Limitations

Only perform the extended check if the value attribute array has a length > 1.
Cache compiled regexs that correspond to entries in the value attribute? (Keyed by method signature?)
Gate the extend check behind config in case performance issues pop up.

@workato-integration
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant