Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
// Configure the spans transport sender
final Sender sender = ...; 

/**
 * For example:
 *
 * final Sender sender = LibthriftSender.create("localhost");; 
 */
        
final Brave brave = new Brave.Builder("tracer")
    .reporter(AsyncReporter.builder(sender).build())
    .traceSampler(Sampler.ALWAYS_SAMPLE) /* or any other Sampler */ 
    .build();
             
final JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
...
sf.getFeatures().add(new BraveClientFeature(brave));
...
sf.create();

Distributed Tracing with OpenZipkin Brave and OSGi

OpenZipkin Brave could be deployed into OSGi container and as such, distributed tracing integration is fully available for Apache CXF services running inside the container. For a complete example please take a look on jax_ws_tracing_brave_osgi sample project, but here is the typical OSGi  Blueprint snippet:

Code Block
xml
xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://cxf.apache.org/blueprint/core"
       xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"

       xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                           http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
                           http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd">

    <!-- CXF BraveFeature -->
    <bean id="braveFeature" class="org.apache.cxf.tracing.brave.BraveFeature">
        <argument index="0" ref="brave" />
    </bean>
    
    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>
    
    <bean id="catalogServiceImpl" class="demo.jaxws.tracing.server.impl.CatalogServiceImpl">
        <argument index="0" ref="brave" />
    </bean>
    
    <bean id="braveBuilder" class="com.github.kristofa.brave.Brave.Builder">
        <argument index="0" value="catalog-service" />
    </bean>
    
    <bean id="brave" factory-ref="braveBuilder" factory-method="build" />
    
    <jaxws:endpoint
        implementor="#catalogServiceImpl"
        address="/catalog"
        implementorClass="demo.jaxws.tracing.server.impl.CatalogServiceImpl">
        <jaxws:features>
            <ref component-id="braveFeature" />
        </jaxws:features>
    </jaxws:endpoint>
</blueprint>

 

Migrating from brave-cxf3

...