dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] In the example dubco-samples-spring-boot-trace-skywalking, the run fails

Open glynnwei opened this issue 9 months ago • 2 comments

Pre-check

  • [X] I am sure that all the content I provide is in English.

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java Samples (apache/dubbo-samples)

Dubbo Version

Dubbo: 3.2.6 JDK: 1.8 SpringBoot: 2.6.4

Steps to reproduce this issue

run error

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method applicationModel in org.apache.dubbo.springboot.skywalking.demo.provider.ObservationConfiguration required a bean of type 'io.micrometer.observation.ObservationRegistry' that could not be found.


Action:

Consider defining a bean of type 'io.micrometer.observation.ObservationRegistry' in your configuration.

What you expected to happen

Class:ObservationConfiguration Method:applicationModel Param: ObservationRegistry observationRegistry Unknown source, need to inject?

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [X] Yes I am willing to submit a pull request on my own!

Code of Conduct

glynnwei avatar May 10 '24 12:05 glynnwei

@conghuhu @songxiaosheng PTAL

AlbumenJ avatar May 11 '24 06:05 AlbumenJ

@xiaozhigang PATL

songxiaosheng avatar May 13 '24 10:05 songxiaosheng

your jdk:1.8 requirement:jdk-17

xiaozhigang avatar May 31 '24 12:05 xiaozhigang

your jdk:1.8 requirement:jdk-17

Support 1.8, do not change 17 org.apache.dubbo.springboot.skywalking.demo.provider.ObservationConfiguration add fix code:

@ConditionalOnBean(ObservationRegistry.class)
@Bean
ApplicationModel applicationModel(@Autowired ObservationRegistry observationRegistry) {
    ApplicationModel applicationModel = ApplicationModel.defaultModel();
    observationRegistry.observationConfig()
            .observationHandler(new ObservationHandler.FirstMatchingCompositeObservationHandler(
                    new SkywalkingSenderTracingHandler(), new SkywalkingReceiverTracingHandler(),
                    new SkywalkingDefaultTracingHandler()
            ));
    applicationModel.getBeanFactory().registerBean(observationRegistry);
    return applicationModel;
}

glynnwei avatar Jun 03 '24 11:06 glynnwei