-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AsyncReporter Not Submitting Span Data to Zipkin Server with Servlet 2.5 #385
Comments
hmm you can use span collector or reporter, but not both. When you use a
span collector, it replaces the reporter.
|
Thank @adriancole for explaining why the reporter doesn't work. Bellow are the Spring bean definitions(in Grails BeanBuilder DSL format) and filter definitions, however, there isn't any SpanCollecter settings. Would you please help disable the SpanCollecter? beans = {
sender(OkHttpSender, "http://localhost:9411/api/v1/spans") { bean ->
bean.factoryMethod = "create"
}
reporterBuilder(AsyncReporter, sender) { bean ->
bean.factoryMethod = 'builder'
}
reporter(reporterBuilder:"build")
braveBuilder(Brave$Builder, "myservice")
braveBuilderSetReporter(MethodInvokingFactoryBean){
targetObject = braveBuilder
targetMethod = "reporter"
arguments = reporter
}
brave(braveBuilder:"build")
braveServletFilterBuilder(BraveServletFilter$Builder, brave)
braveServletFilter(braveServletFilterBuilder:"build")
} <filter>
<filter-name>braveZipkinServletFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>braveServletFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>braveZipkinServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> |
Actually i dont see where logging collector is used here. I will look at
this more closely and give an example ok? Might be later or tomorrow latest
…On 30 Apr 2017 13:10, "Ming Jin" ***@***.***> wrote:
Thank @adriancole <https://github.com/adriancole> for explaining why the
reporter doesn't work.
Bellow are the Spring bean definitions(in Grails BeanBuilder DSL format)
and filter definitions, however, there isn't any SpanCollecter settings.
Would you please help disable the SpanCollecter?
beans = {
sender(OkHttpSender, "http://localhost:9411/api/v1/spans") { bean ->
bean.factoryMethod = "create"
}
reporterBuilder(AsyncReporter, sender) { bean ->
bean.factoryMethod = 'builder'
}
reporter(reporterBuilder:"build")
braveBuilder(Brave$Builder, "myservice")
braveBuilderSetReporter(MethodInvokingFactoryBean){
targetObject = braveBuilder
targetMethod = "reporter"
arguments = reporter
}
brave(braveBuilder:"build")
braveServletFilterBuilder(BraveServletFilter$Builder, brave)
braveServletFilter(braveServletFilterBuilder:"build")
}
<filter>
<filter-name>braveZipkinServletFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>braveServletFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>braveZipkinServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD61zT9-hprMKi8EYfq0YQLnrRGzV2Lks5r1Be0gaJpZM4NMdmK>
.
|
@adriancole Thanks for your time. Yes, it's very weird & confused, since the almost same configuration applied in another project(https://github.com/mingjin/example-spring-mvc-initializer/tree/zipkin) works. You can check the code & settings. Bellow is the dependency snippet I'm using on the legacy project: compile 'io.zipkin.java:zipkin:1.16.2'
compile('io.zipkin.brave:brave-core:3.16.0',
'io.zipkin.reporter:zipkin-reporter:0.6.9',
'io.zipkin.reporter:zipkin-sender-okhttp3:0.6.9'){
excludes "zipkin"
}
compile 'io.zipkin.brave:brave-core-spring:3.16.0'
compile 'io.zipkin.brave:brave-web-servlet-filter:3.16.0' |
There's nothing about the dependency configuration that you mention that
will change based on servlet 2.5 or 3 (at least not relating in any way to
reporter). I would look more closely at your configuration to make sure you
have a singleton of Brave, because what might be happening is another
instance might be wired up which has the default logging configuration.
ps. you should update the dependencies anyway. Brave 3 apis still exist in
current versions of brave.
|
After digging into the code, I found out it's due to the misconfiguration of Spring beans, of which the return object of MethodInvokingFactoryBean (with reporter bound) instead of the original 'braveBuilder' should be used to build the Brave instance. The bean definition should be as bellow: braveBuilder(Brave$Builder, "myservice")
braveBuilderWithReporter(MethodInvokingFactoryBean){
targetObject = braveBuilder
targetMethod = "reporter"
arguments = reporter
}
brave(braveBuilderWithReporter:"build") // instead of 'braveBuilder' Besides, I upgrade the Brave and zipkins to new versions as bellow: compile 'io.zipkin.java:zipkin:1.19.2'
compile('io.zipkin.brave:brave-core:4.0.6',
'io.zipkin.reporter:zipkin-reporter:0.6.12',
'io.zipkin.reporter:zipkin-sender-urlconnection:0.6.12'){
excludes "zipkin"
}
compile 'io.zipkin.brave:brave-core-spring:4.0.6'
compile 'io.zipkin.brave:brave-web-servlet-filter:4.0.6' Now Brave / AsyncReporter submits span data correctly to Zipkin server as expected. Thank @adriancole , and hope this help other guys in the future. |
Ah yeah that looked subtle. Good job figuring it out
…On 3 May 2017 9:19 pm, "Ming Jin" ***@***.***> wrote:
After digging into the code, I found out it's due to the misconfiguration
of Spring beans, of which the return object of MethodInvokingFactoryBean
(with reporter bound) instead of the original 'braveBuilder' should be used
to build the Brave instance.
The bean definition should be as bellow:
braveBuilder(Brave$Builder, "myservice")
braveBuilderWithReporter(MethodInvokingFactoryBean){
targetObject = braveBuilder
targetMethod = "reporter"
arguments = reporter
}
brave(braveBuilderWithReporter:"build") // instead of 'braveBuilder'
Besides, I upgrade the Brave and zipkins to new versions as bellow:
compile 'io.zipkin.java:zipkin:1.19.2'
compile('io.zipkin.brave:brave-core:4.0.6',
'io.zipkin.reporter:zipkin-reporter:0.6.12',
'io.zipkin.reporter:zipkin-sender-urlconnection:0.6.12'){
excludes "zipkin"
}
compile 'io.zipkin.brave:brave-core-spring:4.0.6'
compile 'io.zipkin.brave:brave-web-servlet-filter:4.0.6'
Now Brave / AsyncReporter submits span data correctly to Zipkin server as
expected.
Thank @adriancole <https://github.com/adriancole> , and hope this help
other guys in the future.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#385 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD612m6jsJD1H0F_u5a9glOm7TOylXXks5r2H7PgaJpZM4NMdmK>
.
|
Brave 4.3 is being released now and include new support for Spring XML configuration, etc. Please give it a try |
We have a legacy system, which is based on Spring web 3.0.5 & Servlet 2.5. I'm trying to introduce brave 3.16.0 & zipkin-reporter 0.6.9 to trace the request / response.
When I set up BraveServletFilter with LoggingReporter in web.xml, I can see the correct output on the console:
But when I changed it to BraveServletFilter with AsyncReporter and OkHttpSender, I can't see the trace data on the zipkin server, although I can still see the logging on the console:
I also create a sample(https://github.com/mingjin/example-spring-mvc-initializer/blob/zipkin/src/main/java/eu/kielczewski/example/initializer/AppInitializer.java) about AsyncReporter and OkHttpSender with Servlet 3.x and WebApplicationInitializer, everything works fine.
So my questions are:
Thanks,
The text was updated successfully, but these errors were encountered: