io.jaegertracing.Configuration Java Examples

The following examples show how to use io.jaegertracing.Configuration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JaegerConfigurator.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public Tracer getTracer() {
  SamplerConfiguration sampleConf = SamplerConfiguration.fromEnv()
    .withType(type);

  if (param != null) {
    sampleConf.withParam(param);
  }

  ReporterConfiguration reportConf = ReporterConfiguration.fromEnv()
    .withLogSpans(logSpans);

  Configuration config = new Configuration(name)
    .withReporter(reportConf)
    .withSampler(sampleConf);

  // If the user gets rid of their tracer config and then puts it back, we want to get a fresh tracer since the old
  // one will be closed.
  return config.getTracer();
}
 
Example #2
Source File: OpenTracingUtil.java    From problematic-microservices with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static void configureOpenTracing(Properties configuration, String serviceName) {
	Tracer tracer = null;
	String tracerName = configuration.getProperty("tracer");
	if ("jaeger".equals(tracerName)) {
		SamplerConfiguration samplerConfig = new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1);
		SenderConfiguration senderConfig = new SenderConfiguration()
				.withAgentHost(configuration.getProperty("jaeger.reporter.host"))
				.withAgentPort(Integer.decode(configuration.getProperty("jaeger.reporter.port")));
		ReporterConfiguration reporterConfig = new ReporterConfiguration().withLogSpans(true)
				.withFlushInterval(1000).withMaxQueueSize(10000).withSender(senderConfig);
		tracer = new Configuration(serviceName).withSampler(samplerConfig).withReporter(reporterConfig).getTracer();
	} else if ("zipkin".equals(tracerName)) {
		OkHttpSender sender = OkHttpSender.create("http://" + configuration.getProperty("zipkin.reporter.host")
				+ ":" + configuration.getProperty("zipkin.reporter.port") + "/api/v2/spans");
		Reporter<Span> reporter = AsyncReporter.builder(sender).build();
		tracer = BraveTracer
				.create(Tracing.newBuilder().localServiceName(serviceName).spanReporter(reporter).build());
	}
	GlobalTracer.register(new DelegatingJfrTracer(tracer));
}
 
Example #3
Source File: ServingServiceGRpcControllerTest.java    From feast with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
  initMocks(this);

  validRequest =
      GetOnlineFeaturesRequest.newBuilder()
          .addFeatures(FeatureReference.newBuilder().setName("feature1").build())
          .addFeatures(FeatureReference.newBuilder().setName("feature2").build())
          .addEntityRows(
              EntityRow.newBuilder()
                  .setEntityTimestamp(Timestamp.newBuilder().setSeconds(100))
                  .putFields("entity1", Value.newBuilder().setInt64Val(1).build())
                  .putFields("entity2", Value.newBuilder().setInt64Val(1).build()))
          .build();

  Tracer tracer = Configuration.fromEnv("dummy").getTracer();
  FeastProperties feastProperties = new FeastProperties();
  service = new ServingServiceGRpcController(mockServingService, feastProperties, tracer);
}
 
Example #4
Source File: Commons.java    From demo-mesh-arena with Apache License 2.0 6 votes vote down vote up
public static Optional<Tracer> getTracer(String service) {
  if (!tracerSet) {
    if (TRACING_ENABLED == 1) {
      Configuration c = new Configuration(service)
          .withSampler(new Configuration.SamplerConfiguration()
              .withType("const")
              .withParam(1))
          .withCodec(new Configuration.CodecConfiguration()
              .withPropagation(Configuration.Propagation.B3))
          .withReporter(new Configuration.ReporterConfiguration()
              .withSender(new Configuration.SenderConfiguration().withEndpoint("http://localhost:14268/api/traces")));
      tracer = Optional.of(c.getTracer());
    }
    tracerSet = true;
  }
  return tracer;
}
 
Example #5
Source File: Client.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args) throws Exception {
    final Tracer tracer = new Configuration("cxf-client")
        .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1))
        .withReporter(new ReporterConfiguration().withSender(
            new SenderConfiguration()
                .withEndpoint("http://localhost:14268/api/traces")
        ))
        .getTracer();
    
    final OpenTracingClientProvider provider = new OpenTracingClientProvider(tracer);
    final javax.ws.rs.client.Client client = ClientBuilder.newClient().register(provider);
    
    final Response response = client
        .target("http://localhost:8084/catalog")
        .request()
        .accept(MediaType.APPLICATION_JSON)
        .get();
  
    LOG.info("Response: {}", response.readEntity(String.class));
    response.close();
      
    // Allow Tracer to flush
    Thread.sleep(1000);
}
 
Example #6
Source File: KafkaProducerExample.java    From client-examples with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    KafkaProducerConfig config = KafkaProducerConfig.fromEnv();
    Properties props = KafkaProducerConfig.createProperties(config);

    if (System.getenv("JAEGER_SERVICE_NAME") != null)   {
        Tracer tracer = Configuration.fromEnv().getTracer();
        GlobalTracer.registerIfAbsent(tracer);

        props.put(ProducerConfig.INTERCEPTOR_CLASSES_CONFIG, TracingProducerInterceptor.class.getName());
    }

    KafkaProducer producer = new KafkaProducer(props);
    log.info("Sending {} messages ...", config.getMessageCount());
    for (long i = 0; i < config.getMessageCount(); i++) {
        log.info("Sending messages \"" + config.getMessage() + " - {}\"", i);
        producer.send(new ProducerRecord(config.getTopic(),  "\"" + config.getMessage()  + " - " + i + "\""));
        Thread.sleep(config.getDelay());
    }
    log.info("{} messages sent ...", config.getMessageCount());
    producer.close();
}
 
Example #7
Source File: TracingConfig.java    From Mastering-Distributed-Tracing with MIT License 6 votes vote down vote up
@Bean
public io.opentracing.Tracer tracer(CollectorRegistry collector) {
    Configuration configuration = Configuration.fromEnv(app.name);
    Tracer jaegerTracer = configuration.getTracerBuilder() //
            .withSampler(new ConstSampler(true)) //
            .withScopeManager(new MDCScopeManager()) //
            .build();

    PrometheusMetricsReporter reporter = PrometheusMetricsReporter //
            .newMetricsReporter() //
            .withCollectorRegistry(collector) //
            .withConstLabel("service", app.name) //
            .withBaggageLabel("callpath", "") //
            .build();
    return io.opentracing.contrib.metrics.Metrics.decorate(jaegerTracer, reporter);
}
 
Example #8
Source File: JaegerTraceFactory.java    From joyrpc with Apache License 2.0 6 votes vote down vote up
/**
 * 构造发送配置
 *
 * @param parametric 参数
 * @return 发送配置
 */
protected Configuration.SenderConfiguration buildSenderConfiguration(final Parametric parametric) {
    String endpoint = parametric.getString("JAEGER_ENDPOINT");
    if (!StringUtils.isEmpty(endpoint)) {
        try {
            URL url = URL.valueOf(endpoint, "http");
            if (StringUtils.isEmpty(url.getPath())) {
                url = url.setPath("/api/traces");
            }
            endpoint = url.toString();
        } catch (Throwable e) {
        }
    }
    return new Configuration.SenderConfiguration()
            .withAgentHost(parametric.getString("JAEGER_AGENT_HOST"))
            .withAgentPort(parametric.getInteger("JAEGER_AGENT_PORT"))
            .withEndpoint(endpoint)
            .withAuthUsername(parametric.getString("JAEGER_USER"))
            .withAuthPassword(parametric.getString("JAEGER_PASSWORD"))
            .withAuthToken(parametric.getString("JAEGER_AUTH_TOKEN"));
}
 
Example #9
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Bean
Tracer tracer() {
    return new Configuration("camel-server")
        .withSampler(
            new SamplerConfiguration()
                .withType(ConstSampler.TYPE)
                .withParam(1))
        .withReporter(new ReporterConfiguration().withSender(
            new SenderConfiguration()
                .withEndpoint("http://localhost:14268/api/traces")
        ))
        .withCodec(
            new CodecConfiguration()
                .withCodec(Builtin.TEXT_MAP, new TextMapCodec(true))
        )
        .getTracer();
}
 
Example #10
Source File: IntegrationTracingContextCustomizer.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(CamelContext camelContext) {
    // Lets generates always incrementing lexically sortable unique
    // uuids. These uuids are also more compact than the camel default
    // and contain an embedded timestamp.
    camelContext.setUuidGenerator(KeyGenerator::createKey);

    Tracer tracer = Configuration.fromEnv(serviceName).getTracer();
    camelContext.getRegistry().bind("tracer", tracer);

    camelContext.getRegistry().bind("bodyLogger", new BodyLogger.Default());

    TracingInterceptStrategy tis = new TracingInterceptStrategy(tracer);
    camelContext.getRegistry().bind("integrationLoggingInterceptStrategy", tis);
    if (camelContext instanceof ExtendedCamelContext) {
        ExtendedCamelContext ecc = (ExtendedCamelContext) camelContext;
        ecc.addInterceptStrategy(tis);

        // Log listener
        ecc.addLogListener(new TracingLogListener(tracer));
    }

    LOGGER.info("Added opentracing to CamelContext.");
}
 
Example #11
Source File: Client.java    From cxf with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #12
Source File: QuarkusJaegerTracer.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private Tracer tracer() {
    if (tracer == null) {
        synchronized (this) {
            if (tracer == null) {
                tracer = Configuration.fromEnv()
                        .withMetricsFactory(metricsFactory)
                        .getTracerBuilder()
                        .withScopeManager(getScopeManager())
                        .build();
            }
        }
    }
    return tracer;
}
 
Example #13
Source File: JaegerConfigurationPropertiesTagsTest.java    From java-spring-jaeger with Apache License 2.0 5 votes vote down vote up
@Test
public void envTagsIncluded() {
  System.setProperty(Configuration.JAEGER_TAGS, "t3, t4 = v4");

  final Map<String, String> tagsInProperties = new HashMap<>();
  tagsInProperties.put("t1", "v1");
  tagsInProperties.put("t2", "v2");
  final JaegerConfigurationProperties properties = new JaegerConfigurationProperties();
  properties.setTags(tagsInProperties);
  properties.setIncludeJaegerEnvTags(true);

  assertThat(properties.determineTags()).containsOnly(entry("t1", "v1"), entry("t2", "v2"), entry("t4", "v4"));
}
 
Example #14
Source File: JaegerConfigurationProperties.java    From java-spring-jaeger with Apache License 2.0 5 votes vote down vote up
private Map<String, String> tracerTagsFromEnv() {
  final Map<String, String> tracerTagMaps = new HashMap<>();
  final String tracerTags = getProperty(Configuration.JAEGER_TAGS);
  if (tracerTags != null) {
    final String[] tags = tracerTags.split("\\s*,\\s*");
    for (String tag : tags) {
      final String[] tagValue = tag.split("\\s*=\\s*");
      if (tagValue.length == 2) {
        tracerTagMaps.put(tagValue[0], tagValue[1]);
      }
    }
  }
  return tracerTagMaps;
}
 
Example #15
Source File: TracingUtil.java    From oxd with Apache License 2.0 5 votes vote down vote up
private static Tracer createTracer(OxdServerConfiguration configuration, String componentName) {
    String tracerName = configuration.getTracer();

    if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) {
        return NoopTracerFactory.create();
    } else if ("jaeger".equals(tracerName)) {
        Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration()
                .withType(ConstSampler.TYPE)
                .withParam(1);

        Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration()
                .withAgentHost(configuration.getTracerHost())
                .withAgentPort(configuration.getTracerPort());

        Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration()
                .withLogSpans(true)
                .withFlushInterval(1000)
                .withMaxQueueSize(10000)
                .withSender(senderConfig);

        return new Configuration(componentName)
                .withSampler(samplerConfig)
                .withReporter(reporterConfig)
                .getTracer();
    } else if ("zipkin".equals(tracerName)) {
        OkHttpSender sender = OkHttpSender.create(
                "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans");

        Reporter<Span> reporter = AsyncReporter.builder(sender).build();

        return BraveTracer.create(Tracing.newBuilder()
                .localServiceName(componentName)
                .spanReporter(reporter)
                .build());
    } else {
        return NoopTracerFactory.create();
    }
}
 
Example #16
Source File: KafkaConsumerExample.java    From client-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    KafkaConsumerConfig config = KafkaConsumerConfig.fromEnv();
    Properties props = KafkaConsumerConfig.createProperties(config);
    int receivedMsgs = 0;

    if (System.getenv("JAEGER_SERVICE_NAME") != null)   {
        Tracer tracer = Configuration.fromEnv().getTracer();
        GlobalTracer.registerIfAbsent(tracer);

        props.put(ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG, TracingConsumerInterceptor.class.getName());
    }

    boolean commit = !Boolean.parseBoolean(config.getEnableAutoCommit());
    KafkaConsumer consumer = new KafkaConsumer(props);
    consumer.subscribe(Collections.singletonList(config.getTopic()));

    while (receivedMsgs < config.getMessageCount()) {
        ConsumerRecords<String, String> records = consumer.poll(Long.MAX_VALUE);
        for (ConsumerRecord<String, String> record : records) {
            log.info("Received message:");
            log.info("\tpartition: {}", record.partition());
            log.info("\toffset: {}", record.offset());
            log.info("\tvalue: {}", record.value());
            receivedMsgs++;
        }
        if (commit) {
            consumer.commitSync();
        }
    }
}
 
Example #17
Source File: JaegerTraceFactory.java    From joyrpc with Apache License 2.0 5 votes vote down vote up
public JaegerTraceFactory() {
    Map<String, Object> global = GlobalContext.getContext();
    Object obj = global.get(TRACE_JAEGER);
    if (obj instanceof JaegerTracer) {
        //判断是否有全局的变量
        tracer = (JaegerTracer) obj;
    } else {
        Parametric parametric = Variable.VARIABLE;
        Configuration configuration = new Configuration(parametric.getString("appService", KEY_APPNAME, "unknown"));
        configuration.withSampler(buildSamplerConfiguration(parametric));
        configuration.withReporter(buildReporterConfiguration(parametric));
        tracer = configuration.getTracer();
    }
}
 
Example #18
Source File: TracingContextCustomizer.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(CamelContext camelContext) {
    ObjectHelper.notNull(serviceName, "service-name");

    Tracer tracer = new Configuration(camelContext.getName())
        .withServiceName(serviceName)
        .withTracerTags(tags != null ? tags : Collections.emptyMap())
        .withReporter(reporter)
        .withSampler(sampler)
        .getTracer();

    OpenTracingTracer openTracingTracer = new OpenTracingTracer();
    openTracingTracer.setTracer(tracer);
    openTracingTracer.init(camelContext);
}
 
Example #19
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Bean @Qualifier("cxf")
Tracer cxfTracer() {
    return new Configuration("cxf-service")
            .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1))
            .withReporter(new ReporterConfiguration().withSender(
                new SenderConfiguration()
                    .withEndpoint("http://localhost:14268/api/traces")
            ))
            .getTracer();
}
 
Example #20
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Server() throws Exception {
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000);

    // Register and map the dispatcher servlet
    final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
    final ServletContextHandler context = new ServletContextHandler();
    context.setContextPath("/");
    context.addServlet(servletHolder, "/*");

    servletHolder.setInitParameter("javax.ws.rs.Application",
        CatalogApplication.class.getName());

    final Tracer tracer = new Configuration("tracer-server")
        .withSampler(new SamplerConfiguration().withType(ConstSampler.TYPE).withParam(1))
        .withReporter(new ReporterConfiguration().withSender(
            new SenderConfiguration() {
                @Override
                public Sender getSender() {
                    return new Slf4jLogSender();
                }
            }
        ))
        .getTracer();
    GlobalTracer.registerIfAbsent(tracer);
    
    server.setHandler(context);
    server.start();
    server.join();
}
 
Example #21
Source File: Main.java    From batfish with Apache License 2.0 5 votes vote down vote up
private static void initTracer() {
  Configuration config =
      new Configuration(_settings.getServiceName())
          .withSampler(new SamplerConfiguration().withType("const").withParam(1))
          .withReporter(
              new ReporterConfiguration()
                  .withSender(
                      SenderConfiguration.fromEnv()
                          .withAgentHost(_settings.getTracingAgentHost())
                          .withAgentPort(_settings.getTracingAgentPort()))
                  .withLogSpans(false));
  GlobalTracer.registerIfAbsent(config.getTracer());
}
 
Example #22
Source File: AllInOne.java    From batfish with Apache License 2.0 5 votes vote down vote up
private void initTracer() {
  Configuration config =
      new Configuration(_settings.getServiceName())
          .withSampler(new SamplerConfiguration().withType("const").withParam(1))
          .withReporter(
              new ReporterConfiguration()
                  .withSender(
                      SenderConfiguration.fromEnv()
                          .withAgentHost(_settings.getTracingAgentHost())
                          .withAgentPort(_settings.getTracingAgentPort()))
                  .withLogSpans(false));
  GlobalTracer.registerIfAbsent(config.getTracer());
}
 
Example #23
Source File: Client.java    From batfish with Apache License 2.0 5 votes vote down vote up
private void initTracer() {
  Configuration config =
      new Configuration(_settings.getServiceName())
          .withSampler(new SamplerConfiguration().withType("const").withParam(1))
          .withReporter(
              new ReporterConfiguration()
                  .withSender(
                      SenderConfiguration.fromEnv()
                          .withAgentHost(_settings.getTracingAgentHost())
                          .withAgentPort(_settings.getTracingAgentPort()))
                  .withLogSpans(false));
  GlobalTracer.registerIfAbsent(config.getTracer());
}
 
Example #24
Source File: MeteredTracerProvider.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Inject
public MeteredTracerProvider(Set<MetricsReporter> metricsReporter) {
  MicrometerMetricsFactory internalMetricsFactory = new MicrometerMetricsFactory();
  Configuration configuration = Configuration.fromEnv();
  Tracer tracer =
      configuration.getTracerBuilder().withMetricsFactory(internalMetricsFactory).build();

  this.tracerProvider = new TracerProvider(Metrics.decorate(tracer, metricsReporter));
}
 
Example #25
Source File: TracingAgent.java    From strimzi-kafka-operator with Apache License 2.0 5 votes vote down vote up
/**
 * Agent entry point
 *
 * @param agentArgs The type of tracing which should be initialized
 */
public static void premain(String agentArgs) {
    if ("jaeger".equals(agentArgs)) {
        String jaegerServiceName = System.getenv("JAEGER_SERVICE_NAME");

        if (jaegerServiceName != null) {
            LOGGER.info("Initializing Jaeger tracing with service name {}", jaegerServiceName);
            Tracer tracer = Configuration.fromEnv().getTracer();
            GlobalTracer.registerIfAbsent(tracer);
        } else {
            LOGGER.error("Jaeger tracing cannot be initialized because JAEGER_SERVICE_NAME environment variable is not defined");
        }
    }
}
 
Example #26
Source File: JaegerStartupHookProvider.java    From light-4j with Apache License 2.0 5 votes vote down vote up
@Override
public void onStartup() {
    // register the service instance to the Jaeger tracer agent and create a tracer object if it is enabled.
    if(jaegerConfig.isEnabled()) {
        Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration().withType(jaegerConfig.getType()).withParam(jaegerConfig.getParam());
        Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration().withLogSpans(true);
        tracer = new Configuration(serverConfig.getServiceId()).withSampler(samplerConfig).withReporter(reporterConfig).getTracer();
    }
}
 
Example #27
Source File: TracingUtil.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the tracing with the given service name.
 */
public static void initTracing(
    String serviceName, ConfigurationSource conf) {
  if (!GlobalTracer.isRegistered() && isTracingEnabled(conf)) {
    Configuration config = Configuration.fromEnv(serviceName);
    JaegerTracer tracer = config.getTracerBuilder()
        .registerExtractor(StringCodec.FORMAT, new StringCodec())
        .registerInjector(StringCodec.FORMAT, new StringCodec())
        .build();
    GlobalTracer.register(tracer);
  }
}
 
Example #28
Source File: Tracing.java    From opentracing-tutorial with Apache License 2.0 5 votes vote down vote up
public static JaegerTracer init(String service) {
    SamplerConfiguration samplerConfig = SamplerConfiguration.fromEnv()
            .withType(ConstSampler.TYPE)
            .withParam(1);

    ReporterConfiguration reporterConfig = ReporterConfiguration.fromEnv()
            .withLogSpans(true);

    Configuration config = new Configuration(service)
            .withSampler(samplerConfig)
            .withReporter(reporterConfig);

    return config.getTracer();
}
 
Example #29
Source File: JaegerAndMicroprofileOpenTracingTest.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDown() throws Exception {
  System.clearProperty(Configuration.JAEGER_SERVICE_NAME);
}
 
Example #30
Source File: JaegerInitializer.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
    ServletContext sc = servletContextEvent.getServletContext();

    String serviceName = getProperty(sc, JAEGER_SERVICE_NAME);
    if (serviceName == null || serviceName.isEmpty()) {
        logger.warn("No Service Name set. Using default. Please change it.");
        serviceName = "thorntail/unknown";
    }

    Configuration configuration = new Configuration(serviceName)
            .withSampler(
                    new Configuration.SamplerConfiguration()
                            .withType(
                                    getProperty(sc, JAEGER_SAMPLER_TYPE))
                            .withParam(
                                    getPropertyAsNumber(sc, JAEGER_SAMPLER_PARAM))
                            .withManagerHostPort(
                                    getProperty(sc, JAEGER_SAMPLER_MANAGER_HOST_PORT)))
            .withReporter(
                    new ReporterConfiguration()
                            .withLogSpans(
                                    getPropertyAsBoolean(sc, JAEGER_REPORTER_LOG_SPANS))
                            .withSender(
                                    new SenderConfiguration()
                                            .withAuthUsername(getProperty(sc, JAEGER_USER))
                                            .withAuthPassword(getProperty(sc, JAEGER_PASSWORD))
                                            .withAgentHost(getProperty(sc, JAEGER_AGENT_HOST))
                                            .withAgentPort(getPropertyAsInt(sc, JAEGER_AGENT_PORT)))
                            .withFlushInterval(
                                    getPropertyAsInt(sc, JAEGER_REPORTER_FLUSH_INTERVAL))
                            .withMaxQueueSize(
                                    getPropertyAsInt(sc, JAEGER_REPORTER_MAX_QUEUE_SIZE)
                            )
            );

    String remoteEndpoint = getProperty(sc, JAEGER_ENDPOINT);
    if (remoteEndpoint != null && remoteEndpoint.trim().length() > 0) {
        configuration.getReporter()
                .withSender(new SenderConfiguration()
                                    .withEndpoint(remoteEndpoint));
    }

    String enableB3HeaderPropagation = getProperty(sc, "enableB3HeaderPropagation");
    if (enableB3HeaderPropagation != null && Boolean.parseBoolean(enableB3HeaderPropagation)) {
        logger.info("Enabling B3 Header Propagation for Jaeger");
        CodecConfiguration codecConfiguration = new CodecConfiguration();
        codecConfiguration.withCodec(Builtin.HTTP_HEADERS, new B3TextMapCodec.Builder().build());
        codecConfiguration.withCodec(Builtin.TEXT_MAP, new B3TextMapCodec.Builder().build());
        configuration.withCodec(codecConfiguration);
    }

    GlobalTracer.register(configuration.getTracer());
}