Search in sources :

Example 1 with ReporterConfiguration

use of io.jaegertracing.Configuration.ReporterConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testReporterConfiguration.

@Test
public void testReporterConfiguration() {
    System.setProperty(Configuration.JAEGER_REPORTER_LOG_SPANS, "true");
    System.setProperty(Configuration.JAEGER_AGENT_HOST, "MyHost");
    System.setProperty(Configuration.JAEGER_AGENT_PORT, "1234");
    System.setProperty(Configuration.JAEGER_REPORTER_FLUSH_INTERVAL, "500");
    System.setProperty(Configuration.JAEGER_REPORTER_MAX_QUEUE_SIZE, "1000");
    ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv();
    assertTrue(reporterConfig.getLogSpans());
    assertEquals("MyHost", reporterConfig.getSenderConfiguration().getAgentHost());
    assertEquals(1234, reporterConfig.getSenderConfiguration().getAgentPort().intValue());
    assertEquals(500, reporterConfig.getFlushIntervalMs().intValue());
    assertEquals(1000, reporterConfig.getMaxQueueSize().intValue());
}
Also used : ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Test(org.junit.Test)

Example 2 with ReporterConfiguration

use of io.jaegertracing.Configuration.ReporterConfiguration in project jaeger-client-java by jaegertracing.

the class TraceBehaviorResourceTest method setUp.

@Before
public void setUp() throws Exception {
    Configuration configuration = new Configuration(SERVICE_NAME).withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(0)).withReporter(new ReporterConfiguration().withLogSpans(true));
    server = new JerseyServer("127.0.0.1", port, configuration, Collections.singletonList(new TraceBehaviorResource(configuration.getTracer())));
    hostPort = String.format("127.0.0.1:%d", port);
    behavior = new TraceBehavior(server.getTracer());
}
Also used : ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Configuration(io.jaegertracing.Configuration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) JerseyServer(io.jaegertracing.crossdock.JerseyServer) TraceBehavior(io.jaegertracing.crossdock.resources.behavior.TraceBehavior) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Before(org.junit.Before)

Example 3 with ReporterConfiguration

use of io.jaegertracing.Configuration.ReporterConfiguration in project cxf by apache.

the class Client method main.

public static void main(final String[] args) throws Exception {
    final Tracer tracer = new Configuration("tracer-client").withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1)).withReporter(new ReporterConfiguration().withSender(new SenderConfiguration() {

        @Override
        public Sender getSender() {
            return new Slf4jLogSender();
        }
    })).getTracer();
    final OpenTracingClientProvider provider = new OpenTracingClientProvider(tracer);
    final Response response = WebClient.create("http://localhost:9000/catalog", Arrays.asList(provider)).accept(MediaType.APPLICATION_JSON).get();
    System.out.println(response.readEntity(String.class));
    response.close();
}
Also used : Slf4jLogSender(demo.jaxrs.tracing.Slf4jLogSender) Sender(io.jaegertracing.spi.Sender) Response(javax.ws.rs.core.Response) SenderConfiguration(io.jaegertracing.Configuration.SenderConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Configuration(io.jaegertracing.Configuration) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Tracer(io.opentracing.Tracer) OpenTracingClientProvider(org.apache.cxf.tracing.opentracing.jaxrs.OpenTracingClientProvider) SamplerConfiguration(io.jaegertracing.Configuration.SamplerConfiguration) Slf4jLogSender(demo.jaxrs.tracing.Slf4jLogSender) SenderConfiguration(io.jaegertracing.Configuration.SenderConfiguration) ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration)

Example 4 with ReporterConfiguration

use of io.jaegertracing.Configuration.ReporterConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testReporterConfigurationInvalidFlushInterval.

@Test
public void testReporterConfigurationInvalidFlushInterval() {
    System.setProperty(Configuration.JAEGER_REPORTER_FLUSH_INTERVAL, "X");
    ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv();
    assertNull(reporterConfig.getFlushIntervalMs());
}
Also used : ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Test(org.junit.Test)

Example 5 with ReporterConfiguration

use of io.jaegertracing.Configuration.ReporterConfiguration in project jaeger-client-java by jaegertracing.

the class ConfigurationTest method testReporterConfigurationInvalidLogSpans.

@Test
public void testReporterConfigurationInvalidLogSpans() {
    System.setProperty(Configuration.JAEGER_REPORTER_LOG_SPANS, "X");
    ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv();
    assertFalse(reporterConfig.getLogSpans());
}
Also used : ReporterConfiguration(io.jaegertracing.Configuration.ReporterConfiguration) Test(org.junit.Test)

Aggregations

ReporterConfiguration (io.jaegertracing.Configuration.ReporterConfiguration)6 Configuration (io.jaegertracing.Configuration)3 SamplerConfiguration (io.jaegertracing.Configuration.SamplerConfiguration)3 Test (org.junit.Test)3 Slf4jLogSender (demo.jaxrs.tracing.Slf4jLogSender)1 SenderConfiguration (io.jaegertracing.Configuration.SenderConfiguration)1 JerseyServer (io.jaegertracing.crossdock.JerseyServer)1 EndToEndBehavior (io.jaegertracing.crossdock.resources.behavior.EndToEndBehavior)1 TraceBehavior (io.jaegertracing.crossdock.resources.behavior.TraceBehavior)1 EndToEndBehaviorResource (io.jaegertracing.crossdock.resources.behavior.http.EndToEndBehaviorResource)1 TraceBehaviorResource (io.jaegertracing.crossdock.resources.behavior.http.TraceBehaviorResource)1 HealthResource (io.jaegertracing.crossdock.resources.health.HealthResource)1 Sender (io.jaegertracing.spi.Sender)1 Tracer (io.opentracing.Tracer)1 Response (javax.ws.rs.core.Response)1 OpenTracingClientProvider (org.apache.cxf.tracing.opentracing.jaxrs.OpenTracingClientProvider)1 NetworkListener (org.glassfish.grizzly.http.server.NetworkListener)1 Before (org.junit.Before)1