forked from vert-x3/vertx-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGateway.java
38 lines (29 loc) · 1.22 KB
/
Gateway.java
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
35
36
37
38
package io.vertx.example.opentracing;
import io.jaegertracing.Configuration;
import io.jaegertracing.internal.samplers.ConstSampler;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.example.tracing.GatewayVerticle;
import io.vertx.tracing.opentracing.OpenTracingOptions;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
public class Gateway {
public static void main(String[] args) throws InterruptedException, ExecutionException, TimeoutException {
Configuration.SamplerConfiguration samplerConfig = Configuration.SamplerConfiguration.fromEnv()
.withType(ConstSampler.TYPE)
.withParam(1);
Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration()
.withLogSpans(true);
Configuration config = new Configuration("Gateway")
.withSampler(samplerConfig)
.withReporter(reporterConfig);
Vertx vertx = Vertx.vertx(new VertxOptions()
.setTracingOptions(new OpenTracingOptions(config.getTracer())
));
vertx.deployVerticle(new GatewayVerticle())
.toCompletionStage()
.toCompletableFuture()
.get(30, TimeUnit.SECONDS);
}
}