Versions Compared

Key

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

...

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: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="withReporter" factory-method="getTracer" />
        </argument>
    </bean>

    <bean id="samplerBuilder" class="io.jaegertracing.Configuration.SamplerConfiguration" />
    
    <bean id="withType" factory-ref="samplerBuilder" factory-method="withType">
        <argument index="0" value="const"/>
    </bean>
    
    <bean id="sampler" factory-ref="withType" factory-method="withParam">
        <argument index="0">
            <bean class="java.lang.Integer">
                <argument value="1" />
            </bean>
        </argument>
    </bean>
    
    <bean id="senderBuilder" class="io.jaegertracing.Configuration.SenderConfiguration" />
    
    <bean id="sender" factory-ref="senderBuilder" factory-method="withEndpoint">
        <argument index="0" value="http://localhost:14268/api/traces"/>
    </bean>
    
    <bean id="reporterBuilder" class="io.jaegertracing.Configuration.ReporterConfiguration" />
    
    <bean id="reporter" factory-ref="reporterBuilder" factory-method="withSender">
        <argument index="0" ref="sender"/>
    </bean>
    
    <bean id="builder" class="io.jaegertracing.Configuration">
        <argument index="0" value="cxf-server" />
    </bean>

    <bean id="withSampler" factory-ref="builder" factory-method="withSampler">
        <argument index="0" ref="sampler"/>
    </bean>
    
    <bean id="withReporter" factory-ref="withSampler" factory-method="withReporter">
        <argument index="0" ref="reporter"/>
    </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>


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.