From f3057169528c686501f6cd2595c45b75579dd1d0 Mon Sep 17 00:00:00 2001 From: yanghao <73453250+yanghao605@users.noreply.github.com> Date: Mon, 11 Dec 2023 09:32:13 +0800 Subject: [PATCH] [#4035] fix invocation context loss issue (#4087) --- .../tracing/zipkin/ZipkinTracingFilter.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java index 9f162f6489b..4bc8f415e99 100644 --- a/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java +++ b/handlers/handler-tracing-zipkin/src/main/java/org/apache/servicecomb/tracing/zipkin/ZipkinTracingFilter.java @@ -37,21 +37,14 @@ public class ZipkinTracingFilter extends AbstractFilter implements ConsumerFilter, ProviderFilter { public static final String NAME = "zipkin"; - private ZipkinConsumerDelegate consumer; - - private ZipkinProviderDelegate producer; + @Autowired + private HttpTracing httpTracing; @Override public String getName() { return NAME; } - @Autowired - public void setHttpTracing(HttpTracing httpTracing) { - this.consumer = new ZipkinConsumerDelegate(httpTracing); - this.producer = new ZipkinProviderDelegate(httpTracing); - } - @SuppressWarnings({"try", "unused"}) @Override public CompletableFuture onFilter(Invocation invocation, FilterNode nextNode) { @@ -66,9 +59,9 @@ public CompletableFuture onFilter(Invocation invocation, FilterNode ne private ZipkinTracingDelegate collectTracing(Invocation invocation) { if (PROVIDER.equals(invocation.getInvocationType())) { - return producer; + return new ZipkinProviderDelegate(httpTracing); } - return consumer; + return new ZipkinConsumerDelegate(httpTracing); } }