我提问:如果系统使用tcp服务调用,Zipkin可以用追踪链路吗
灵码的回复:
当系统使用 TCP 服务调用时,传统的基于 HTTP 的分布式追踪工具(如 Zipkin 或 Jaeger)可能无法直接支持 TCP 调用的追踪。但是,可以通过一些方法来扩展和自定义追踪工具,使其能够支持 TCP 服务调用。
解决方案
自定义 Span 生成
手动记录 Span 数据
详细步骤
import brave.Span;
import brave.Tracer;
import brave.handler.FinishedSpanHandler;
import brave.propagation.TraceContext;
import brave.propagation.TraceContext.Extractor;
import brave.propagation.TraceContext.Injector;
import brave.propagation.TraceContextOrSamplingFlags;
import brave.propagation.TraceContextOrSamplingFlagsParser;
import brave.propagation.TraceContextOrSamplingFlagsParser.Parser;
import brave.sampler.Sampler;
import brave.sampler.SamplerFunction;
import brave.spring.webmvc.SpanCustomizer;
import brave.spring.webmvc.TracingHandlerInterceptor;
import brave.spring.webmvc.TracingHandlerInterceptorAutoConfiguration;
import brave.spring.webmvc.TracingWebAutoConfiguration;
import brave.spring.webmvc.config.TracingAutoConfiguration;
import brave.spring.webmvc.config.TracingWebMvcAutoConfiguration;
import brave.spring.webmvc.filter.TracingFilterAutoConfiguration;
import brave.spring.webmvc.servlet.TracingServletAutoConfiguration;
import brave.spring.webmvc.servlet.TracingServletConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBean;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapter;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerAdapterConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurerConfigurer;
import brave.spring.webmvc.servlet.TracingServletRegistrationBeanCustomizerConfigurerAdapter
然后一直输出import
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
通义灵码是基于通义大模型的 AI 研发辅助工具,提供代码生成、研发问答、任务执行等能力,为开发者带来智能化研发体验,引领 AI 原生研发新范式。通义灵码包含 AI 编码助手和 AI 程序员。