Skip to content

Commit f305716

Browse files
authored
[#4035] fix invocation context loss issue (#4087)
1 parent 6066887 commit f305716

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,14 @@
3737
public class ZipkinTracingFilter extends AbstractFilter implements ConsumerFilter, ProviderFilter {
3838
public static final String NAME = "zipkin";
3939

40-
private ZipkinConsumerDelegate consumer;
41-
42-
private ZipkinProviderDelegate producer;
40+
@Autowired
41+
private HttpTracing httpTracing;
4342

4443
@Override
4544
public String getName() {
4645
return NAME;
4746
}
4847

49-
@Autowired
50-
public void setHttpTracing(HttpTracing httpTracing) {
51-
this.consumer = new ZipkinConsumerDelegate(httpTracing);
52-
this.producer = new ZipkinProviderDelegate(httpTracing);
53-
}
54-
5548
@SuppressWarnings({"try", "unused"})
5649
@Override
5750
public CompletableFuture<Response> onFilter(Invocation invocation, FilterNode nextNode) {
@@ -66,9 +59,9 @@ public CompletableFuture<Response> onFilter(Invocation invocation, FilterNode ne
6659

6760
private ZipkinTracingDelegate collectTracing(Invocation invocation) {
6861
if (PROVIDER.equals(invocation.getInvocationType())) {
69-
return producer;
62+
return new ZipkinProviderDelegate(httpTracing);
7063
}
7164

72-
return consumer;
65+
return new ZipkinConsumerDelegate(httpTracing);
7366
}
7467
}

0 commit comments

Comments
 (0)