THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
final Map<String, String> properties = new HashMap<String, String>(); final HTraceConfiguration conf = HTraceConfiguration.fromMap(properties); Trace.addReceiver(new StandardOutSpanReceiver(conf)); final HTraceClientProvider provider = new HTraceClientProvider(new AlwaysSampler(conf)); final Client client = ClientBuilder.newClient().register(provider); final Response response = client .target("http://localhost:8282/rest/api/people") .request() .accept(MediaType.APPLICATION_JSON) .get(); |
Configuring Server
Server configuration is a bit simpler than client one thanks to the feature class available, HTraceFeature. Depending on the way the Apache CXF is used to configure JAX-RS services, it could be part of JAX-RS application configuration, for example:
Code Block | ||||
---|---|---|---|---|
| ||||
@ApplicationPath("/")
public class CatalogApplication extends Application {
@Override
public Set<Object> getSingletons() {
final Map<String, String> properties = new HashMap<String, String>();
properties.put("span.receiver", TracingConfiguration.SPAN_RECEIVER.getName());
properties.put("sampler", AlwaysSampler.class.getName());
return new HashSet<Object>(
Arrays.asList(
new HTraceFeature(HTraceConfiguration.fromMap(properties))
)
);
}
} |