// Module included in the following assemblies:
//
// assembly-setting-up-tracing-kafka-clients.adoc

[id='proc-configuring-jaeger-tracer-kafka-clients-{context}']
= Initializing a Jaeger tracer for Kafka clients

Configure and initialize a Jaeger tracer using a set of xref:ref-tracing-environment-variables-{context}[tracing environment variables].

.Procedure

In each client application:

. Add Maven dependencies for Jaeger to the `pom.xml` file for the client application:
+
[source,xml,subs="attributes+"]
----
<dependency>
    <groupId>io.jaegertracing</groupId>
    <artifactId>jaeger-client</artifactId>
    <version>{JaegerClientVersion}</version>
</dependency>
----

. Define the configuration of the Jaeger tracer using the xref:ref-tracing-environment-variables-{context}[tracing environment variables].

. Create the Jaeger tracer from the environment variables that you defined in step two:
+
[source,java,subs=attributes+]
----
Tracer tracer = Configuration.fromEnv().getTracer();
----
+
NOTE: For alternative ways to initialize a Jaeger tracer, see the https://github.com/jaegertracing/jaeger-client-java/tree/master/jaeger-core[Java OpenTracing library^] documentation.

. Register the Jaeger tracer as a global tracer:
+
[source,java,subs=attributes+]
----
GlobalTracer.register(tracer);
----

A Jaeger tracer is now initialized for the client application to use.