Hi Adrian,
That’s really a good news for the dubbo community, people use dubbo may need
this feature, thanks for your effort.
Everything seems to be in the right way, i have tested `TraceFilter` in a
separate spring project and it works fine (tracing can be auto injected).
I don’t know which part is responsible for the initialization of “tracing”
bean, “spring-cloud-starter-sleuth”? There seems to have some problem with
with the initialization of tracing. When i add configuration of tracing
explicitly and remove InjectTracingFilter, it works:
@Configuration
public class TracingConf {
@Bean
public TracingFactoryBean tracing() {
TracingFactoryBean tracingFactoryBean = new TracingFactoryBean();
return tracingFactoryBean;
}
}
Best regards,
Jun Liu
> On 5 Mar 2018, at 6:34 PM, Adrian Cole <[email protected]> wrote:
>
> Hi!
>
> I am from Zipkin, and we like Dubbo :)
>
> We recently created a TracingFilter, but I am having problems with lifecycle.
>
> I thought that when an ExtensionLoader loads a filter, it would look
> for public setters and then assign them. For example, I'd expect
> something similar to this:
>
> 1. filter = "tracing", so load the associated filter in this case
> TracingFilter
> 2. set any setters on that object (in this case it has setTracing)
> * this for example, would come from spring
>
> What I'm noticing is that this does not occur. I have to manually set
> the dependency of TracingFilter like this:
>
> // TODO: Why isn't TracingFilter.setTracing called automatically by
> Dubbo's spring stuff
> @Configuration class InjectTracingFilter {
> @Autowired Tracing tracing;
>
> @PostConstruct
> public void setTracing() {
> ((TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class)
> .getExtension("tracing"))
> .setTracing(tracing);
> }
> }
>
> Can you please help me fix this? I'd like to use the Tracing instance
> already in spring context.
>
> Here's the related issue
> https://github.com/openzipkin/brave/issues/632#issuecomment-370355437
>
> Thanks,
> -Adrian