Versions Compared

Key

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

...

Code Block
java
java
@ApplicationPath("/")
public class CatalogApplication extends Application {
    @Override
    public Set<Object> getSingletons() {
        final Map<String, String> properties = new HashMap<String, String>();
        properties.put("span.receiver", TracingConfigurationStandardOutSpanReceiver.SPAN_RECEIVERclass.getName());
        properties.put("sampler", AlwaysSampler.class.getName());

        return new HashSet<Object>(
            Arrays.asList(
                new HTraceFeature(HTraceConfiguration.fromMap(properties))
            )
        );
    }
}

Or it could be configured using JAXRSServerFactoryBean, for example:

Code Block
java
java
final Map<String, String> properties = new HashMap<String, String>();
properties.put("span.receiver", StandardOutSpanReceiver.class.getName());
properties.put("sampler", AlwaysSampler.class.getName());

JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(/* application instance */, JAXRSServerFactoryBean.class);
factory.setFeatures(Arrays.< Feature >asList(new HTraceFeature(HTraceConfiguration.fromMap(properties))));
...
return factory.create();