THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
final Map<String, String> properties = new HashMap<String, String>();
properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, ...);
properties.put(Tracer.SAMPLER_CLASSES_KEY, ...);
/**
* For example:
*
* properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, StandardOutSpanReceiver.class.getName());
* properties.put(Tracer.SAMPLER_CLASSES_KEY, AlwaysSampler.class.getName());
*/
final Tracer tracer = new Tracer.Builder()
.name("webclient")
.conf(HTraceConfiguration.fromMap(properties))
.build();
final HTraceClientProvider provider = new HTraceClientProvider(tracer);
final Response response = WebClient
.create("http://localhost:9000/catalog", Arrays.asList(provider))
.accept(MediaType.APPLICATION_JSON)
.get(); |
...
Code Block | ||||
---|---|---|---|---|
| ||||
final Map<String, String> properties = new HashMap<String, String>();
properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, ...);
properties.put(Tracer.SAMPLER_CLASSES_KEY, ...);
/**
* For example:
*
* properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, StandardOutSpanReceiver.class.getName());
* properties.put(Tracer.SAMPLER_CLASSES_KEY, AlwaysSampler.class.getName());
*/
final Tracer tracer = new Tracer.Builder()
.name("jaxrs-client")
.conf(HTraceConfiguration.fromMap(properties))
.build();
final HTraceClientProvider provider = new HTraceClientProvider(tracer);
final Client client = ClientBuilder.newClient().register(provider);
final Response response = client
.target("http://localhost:8282/rest/api/people")
.request()
.accept(MediaType.APPLICATION_JSON)
.get(); |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@ApplicationPath("/")
public class CatalogApplication extends Application {
@Override
public Set<Object> getSingletons() {
final HashMap<String, String> properties = new HashMap<String, String>();
properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, ...);
properties.put(Tracer.SAMPLER_CLASSES_KEY, ...);
/**
* For example:
*
* properties.put(Tracer.SPAN_RECEIVER_CLASSES_KEY, StandardOutSpanReceiver.class.getName());
* properties.put(Tracer.SAMPLER_CLASSES_KEY, AlwaysSampler.class.getName());
*/
return new HashSet<Object>(
Arrays.asList(
new HTraceFeature(HTraceConfiguration.fromMap(properties), "tracer")
)
);
}
} |
...