使用skywalking agent启用千分尺观测为什么只报告一个特定的span?

问题描述 投票:0回答:0

一个有依赖关系的SpringBoot3应用:

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation('org.springframework.cloud:spring-cloud-starter-openfeign:4.0.2')
implementation('io.github.openfeign:feign-micrometer:12.1')

和 ObservationRegistryCustomizer:

@Bean
    public ObservationRegistryCustomizer<ObservationRegistry> observationRegistryCustomizer() {
        return registry -> {
            // Here we add a meter handler
            registry.observationConfig()
                .observationHandler(new ObservationHandler.FirstMatchingCompositeObservationHandler(
                    new SkywalkingMeterHandler(new SkywalkingMeterRegistry())
                ));
            // Here we add tracing handlers
            registry.observationConfig()
                .observationHandler(new ObservationHandler.FirstMatchingCompositeObservationHandler(
                    new SkywalkingSenderTracingHandler(), new SkywalkingReceiverTracingHandler(),
                    new SkywalkingDefaultTracingHandler()
                ));
        };
    }

和家庭控制器:

@GetMapping(path = "/")
    public String home() {
        List<Post> posts = feignClient.loadPosts();
        return "Welcome";
    }

应用程序启动并访问

http://localhost:8080/
后,向Skywalking报告的痕迹是这样的: enter image description here 不知道为什么只有一个span和feign相关,是Micrometer创建的。理论上skywalking agent中apm-feign-default-http-9.x-plugin的
DefaultHttpClientInterceptor
也会创建一个span,但是为什么这个span没有上报给skywalking呢?

如果我删除

ObservationRegistryCustomizer
并重试,报告给Skywalking的痕迹将是这样的:enter image description here这说明
DefaultHttpClientInterceptor
应该是有效的。

那么,我想知道是什么机制产生了这种效果?

trace micrometer skywalking
© www.soinside.com 2019 - 2024. All rights reserved.