Skip to content

Commit

Permalink
fix after source review
Browse files Browse the repository at this point in the history
  • Loading branch information
darknesstm committed Jul 7, 2023
1 parent d7aaeeb commit 51ba252
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/plugins-test.3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ jobs:
- dbcp-2.x-scenario
- jsonrpc4j-1.x-scenario
- gateway-3.x-scenario
- gateway-3.x-filter-context-scenario
- neo4j-4.x-scenario
- oracle-scenario
- druid-1.x-scenario
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public Object afterMethod(Class clazz, Method method, Object[] allArguments, Cla
@Override
public void handleMethodException(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes,
Throwable t) {
LOGGER.error("Failed to getDefault segment Id.", t);
LOGGER.error("Failed to get segment Id.", t);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

public abstract class WebFluxSkyWalkingStaticMethodsAroundInterceptor implements StaticMethodsAroundInterceptor {

protected static EnhancedInstance getInstance(Object o) {
protected EnhancedInstance getInstance(Object o) {
EnhancedInstance instance = null;
if (o instanceof DefaultServerWebExchange && o instanceof EnhancedInstance) {
instance = (EnhancedInstance) o;
Expand All @@ -40,7 +40,7 @@ protected static EnhancedInstance getInstance(Object o) {
return instance;
}

protected static ContextSnapshot getContextSnapshot(Object o) {
protected ContextSnapshot getContextSnapshot(Object o) {
return Optional.ofNullable(getInstance(o))
.map(EnhancedInstance::getSkyWalkingDynamicField)
.filter(ContextSnapshot.class::isInstance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

import static net.bytebuddy.matcher.ElementMatchers.named;

/**
*/
public class WebFluxSkyWalkingTraceContextActivation extends ClassStaticMethodsEnhancePluginDefine {

public static final String TRACE_ID_INTERCEPT_CLASS = "org.apache.skywalking.apm.toolkit.activation.webflux.WebFluxSkyWalkingTraceIDInterceptor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ The `WebFluxSkyWalkingOperators#continueTracing` provides manual tracing continu
// fetch trace ID
String traceId = WebFluxSkyWalkingTraceContext.traceId(exchange);

// fetch segment ID
String segmentId = WebFluxSkyWalkingTraceContext.segmentId(exchange);

// fetch span ID
int spanId = WebFluxSkyWalkingTraceContext.spanId(exchange);

return chain.filter(exchange);
}
```
Expand All @@ -69,7 +75,13 @@ The `WebFluxSkyWalkingOperators#continueTracing` provides manual tracing continu
@Override
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain){
// Set correlation data can be retrieved by upstream nodes.
WebFluxSkyWalkingTraceContext.putCorrelation(exchange, "key", "value");
WebFluxSkyWalkingTraceContext.putCorrelation(exchange, "key1", "value");

// Get correlation data
Optional<String> value2 = WebFluxSkyWalkingTraceContext.getCorrelation(exchange, "key2");

// dosomething...

return chain.filter(exchange);
}
```
Expand Down

0 comments on commit 51ba252

Please sign in to comment.