-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrontendApplication.java
More file actions
34 lines (28 loc) · 1.37 KB
/
FrontendApplication.java
File metadata and controls
34 lines (28 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.expedia.www.haystack.dropwizard.example;
import com.expedia.haystack.dropwizard.bundle.HaystackTracerBundle;
import com.expedia.www.haystack.dropwizard.example.resources.Frontend;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
public class FrontendApplication extends Application<HelloWorldConfiguration> {
// bundle that initializes an instance of io.opentracing.Tracer
private final HaystackTracerBundle<HelloWorldConfiguration> haystackTracerBundle = new HaystackTracerBundle<>();
@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
// the following line initializes server tracing and entertains @Traced
// annotations on Resource methods
bootstrap.addBundle(this.haystackTracerBundle);
}
@Override
public void run(HelloWorldConfiguration helloWorldConfiguration,
Environment environment) {
// the following line registers ClientTracingFeature to trace all
// outbound service calls
final Client client = ClientBuilder.newBuilder()
.register(this.haystackTracerBundle.clientTracingFeature(environment))
.build();
environment.jersey().register(new Frontend(client));
}
}