-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
agentLanguage agent related.Language agent related.featureNew featureNew featurejavaJava agent relatedJava agent related
Milestone
Description
Search before asking
- I had searched in the issues and found no similar feature requirement.
Description
In some cases, we need to determine the tenant ID of the current request based on certain information (such as domain name) in Spring Gateway. Usually, we customize a filter to implement this logic. However, after obtaining this information in the filter, due to the framework of WebFlux, it is currently impossible to directly pass it to downstream nodes through the context of SkyWalking.
Therefore, relevant tool methods are needed to process the snapshot information stored in the ServerWebExchange, so that it can be automatically injected into the context of the subsequent link through the header information "sw8-correlation".
Use case
public class TenantHandler implements GlobalFilter {
// ...
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
WebFluxSkyWalkingTraceContext.putCorrelation(exchange, "TenantId", getTenantIdByDomain(exchange.getRequest()));
// ...
}
}Related issues
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
agentLanguage agent related.Language agent related.featureNew featureNew featurejavaJava agent relatedJava agent related