Skip to content
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

Clears up instructions for dubbo config #637

merged 1 commit into from Mar 7, 2018
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -10,19 +10,60 @@ Note: A Dubbo Provider is a server, and a Dubbo Consumer is a client in
Zipkin terminology.

## Configuration
The filter "tracing" requires an extension of type `brave.Tracing` named
"tracing" configured. Once that's configured, you assign the filter to
your providers and consumers like so:

The filter "tracing" requires an extension of type `Tracing` configured.
Most typically, this is provided by Spring, so have this in place before
proceeding. Here's an example in [XML](../../spring-beans/
Here's an example of with Spring 2.5+ [XML](
<!-- default to trace all services -->
<dubbo:consumer filter="tracing" />
<dubbo:provider filter="tracing" />

Then, configure the filter named "tracing" in your producer or consumer.
Here's an example with

Here's an example of using Spring 2.5+ XML
<!-- a provider -->
<dubbo:service filter="tracing" interface="" ref="demoService"/>
### Registering the `brave.Tracing` extension with Spring
Most typically, the `brave.Tracing` extension is provided by Spring, so
have this in place before proceeding. The bean must be named "tracing"

Here's an example in [XML](../../spring-beans/

### Registering the `brave.Tracing` extension with Java
Dubbo supports custom extensions. You can supply your own instance of
tracing by creating and registering an extension factory:

#### create an extension factory that returns `brave.Tracing`

<!-- or a consumer -->
<dubbo:reference filter="tracing" id="demoService" check="false" interface=""/>
package com.yourcompany.dubbo;
import brave.Tracing;
import zipkin2.reporter.AsyncReporter;
import zipkin2.Span;
public class TracingExtensionFactory implements ExtensionFactory {
@Override public <T> T getExtension(Class<T> type, String name) {
if (type != Tracing.class) return null;
return (T) Tracing.newBuilder()
// NOTE: The reporter should be closed with a shutdown hook
AsyncReporter<Span> spanReporter() {
#### Register that factory using META-INF
Make sure the following line is in `META-INF/dubbo/` in your classpath:
@@ -11,6 +11,7 @@
@@ -34,7 +35,11 @@
TraceContext.Extractor<Map<String, String>> extractor;
TraceContext.Injector<Map<String, String>> injector;

/** {@link ExtensionLoader} supplies the tracing implementation, for example by Spring. */
* {@link ExtensionLoader} supplies the tracing implementation which must be named "tracing". For
* example, if using the {@link SpringExtensionFactory}, only a bean named "tracing" will be
* injected.
public void setTracing(Tracing tracing) {
tracer = tracing.tracer();
extractor = tracing.propagation().extractor(GETTER);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.