HaystackConfig { @Bean public Tracer initTracer(HaystackProperties haystackProperties) { val collectorHeaders = new HashMap<String, String>(); collectorHeaders.put("X-Api-Key", haystackProperties.getApiKey()); collectorHeaders.put("X-Client-Id", haystackProperties.getClientId()); val metricsRegistry = new NoopMetricsRegistry(); val dispatcher = new RemoteDispatcher.Builder( metricsRegistry, new HttpCollectorClient(haystackProperties.getEndpoint(), collectorHeaders) ).withBlockingQueueLimit(haystackProperties.getQueueSize()) .withShutdownTimeoutMillis(haystackProperties.getShutdownInterval()) .withFlushIntervalMillis(haystackProperties.getFlushInterval()) .withExecutorThreadCount(haystackProperties.getThreadCount()) .build(); val httpPropagator = new TextMapPropagator.Builder() .withKeyConvention(new DefaultKeyConvention()) .withURLCodex() .build(); return new Tracer.Builder(metricsRegistry, haystackProperties.getClientId(), dispatcher) .withFormat( Format.Builtin.HTTP_HEADERS, (Extractor<TextMap>) httpPropagator ).withFormat(Format.Builtin.HTTP_HEADERS, (Injector<TextMap>) httpPropagator) .withDualSpanMode() .withIdGenerator(new RandomUUIDGenerator()) .build(); }  @Bean Tracer initTracer(HaystackProperties haystackProperties);  }
@Test public void testHaystackConfig() { assertNotNull(haystackConfig.initTracer(haystackProperties)); }