Versions Compared

Key

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

...

Code Block
languagexml
<?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:jaxrs="http://cxf.apache.org/blueprint/jaxrs"

       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/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd">

    <bean id="tracingFeature" class="org.apache.cxf.tracing.opentracing.jaxrs.OpenTracingFeature">
        <argument index="0">
            <bean factory-ref="builder" factory-method="build" />
        </argument>
    </bean>
    
    <bean id="metrics" class="com.uber.jaeger.metrics.Metrics">
        <argument index="0">
            <bean class="com.uber.jaeger.metrics.StatsFactoryImpl">
                <argument index="0">
                    <bean class="com.uber.jaeger.metrics.NullStatsReporter" />
                </argument>
            </bean>
        </argument>
    </bean>
    
    <bean id="builder" class="com.uber.jaeger.Tracer.Builder">
        <argument index="0" value="cxf-server" />
        <argument index="1">
            <bean class="com.uber.jaeger.reporters.RemoteReporter">
                <argument index="0" ref="sender" />
                <argument index="1" value="1000"/>
                <argument index="2" value="100"/>
                <argument index="3" ref="metrics"/>
            </bean>
        </argument>
        <argument index="2">
            <bean class="com.uber.jaeger.samplers.ConstSampler">
                <argument index="0" value="true" />
            </bean>
        </argument>
    </bean>
    
    <bean id="sender" class="com.uber.jaeger.senders.HttpSender">
        <argument index="0" value="http://localhost:14268/api/traces" />
    </bean>
    
    <cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

    <jaxrs:server id="catalogServer" address="/">
        <jaxrs:serviceBeans>
            ...
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref component-id="tracingFeature" />
        </jaxrs:providers>
    </jaxrs:server>
</blueprint>

Samples

OpenTracing API v0.31.0 and Apache CXF 3.3.x

...

Info

As of now, Jaeger tracer does not provide OSGi bundles and the service loader mechanism is not working very well. It is very likely that you may need to declare own sender configuration instance (overriding getSender method) or use system properties to pick the right one.

Samples