class TracingUtil {

    public static Tracer getTracer(HashMap<String, String> collectorHeaders, Config tracingConfig) {
        collectorHeaders.put(TRACER_HEADER_APIKEY_STRING, tracingConfig.getString(TRACING_APIKEY_STRING));
        collectorHeaders.put(TRACER_HEADER_CLIENTID_STRING, tracingConfig.getString(TRACING_CLIENTID_STRING));
        val metricsRegistry = new NoopMetricsRegistry();
        val dispatcher = createRemoteDispatcher(metricsRegistry, collectorHeaders, tracingConfig);
        val textMapPropagator = createTextMapPropagator();

        return new Tracer.Builder(metricsRegistry, tracingConfig.getString("clientId"), dispatcher)
                .withFormat(
                        Format.Builtin.TEXT_MAP, (Extractor<TextMap>) textMapPropagator
                ).withFormat(Format.Builtin.TEXT_MAP, (Injector<TextMap>) textMapPropagator)
                .withDualSpanMode()
                .withIdGenerator(new RandomUUIDGenerator())
                .build();
    }

}