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

Update route attribute for apache shenyu #11233

Closed
123liuziming opened this issue Apr 26, 2024 · 2 comments
Closed

Update route attribute for apache shenyu #11233

123liuziming opened this issue Apr 26, 2024 · 2 comments
Assignees
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request

Comments

@123liuziming
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When using Apache Shenyu, the server span has no route attribute because Apache Shenyu use customized SpringWebflux WebHandler.

Describe the solution you'd like

image

The workflow of apache shenyu is as follows

  1. The downstream services register themselves to Shenyu Admin and specify the corresponding path for each downstream service.
  2. The Shenyu Broker communicates with the Shenyu Admin and pulls all downstream services.
  3. The upstream application requests the Shenyu Gateway, which gets the meta-information of the downstream service based on the requested HTTP Path, and forwards the request to the downstream

From the above workflow, the services in the gateway can be distinguished into several different groups by the path in the HTTP request received by the Apache Shenyu Broker. Therefore, when the Apache Shenyu Gateway receives an HTTP request and matches the corresponding MetaData based on the HTTP request's path, it can use the request path of this MetaData as the route of the Server Span, and this route is low-cardinality. When there is no match to the corresponding MetaData, it means that it may be accessing the extranet through the gateway, and then the Request Path is high base and no route update will be done in this senario.

When we implement it, we follow the following process

  1. After the org.apache.shenyu.plugin.global.DefaultShenyuContextBuilder#build method completes, put the generated MetaData and put it into the ServerWebExchange.
  2. When the org.apache.shenyu.plugin.global.GlobalPlugin#execute method executes, get the path of the corresponding MetaData from the ServerWebExchange and update the route of the span.

image

Describe alternatives you've considered

record the name of Metadata as the route of the span.

Additional context

No response

@123liuziming 123liuziming added enhancement New feature or request needs triage New issue that requires triage labels Apr 26, 2024
@123liuziming
Copy link
Contributor Author

related to #5629

@steverao steverao added contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome and removed needs triage New issue that requires triage labels May 6, 2024
@123liuziming
Copy link
Contributor Author

Merged into v2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Request makes sense, maintainers probably won't have time, contribution would be welcome enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants