16.7. Kafka 클라이언트의 추적 초기화


OpenTelemetry에 대한 추적기를 초기화한 다음 분산 추적을 위해 클라이언트 애플리케이션을 측정합니다. Kafka 생산자 및 소비자 클라이언트 및 Kafka Streams API 애플리케이션을 계측할 수 있습니다.

추적 환경 변수 세트를 사용하여 추적기를 구성하고 초기화합니다.

프로세스

각 클라이언트 애플리케이션에서 추적기에 대한 종속성을 추가합니다.

  1. 클라이언트 애플리케이션의 pom.xml 파일에 Maven 종속성을 추가합니다.

    OpenTelemetry 종속 항목

    <dependency>
        <groupId>io.opentelemetry.semconv</groupId>
        <artifactId>opentelemetry-semconv</artifactId>
        <version>1.21.0-alpha</version>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-exporter-otlp</artifactId>
        <version>1.34.1</version>
        <exclusions>
            <exclusion>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-exporter-sender-okhttp</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-exporter-sender-grpc-managed-channel</artifactId>
        <version>1.34.1</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
        <version>1.34.1</version>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry.instrumentation</groupId>
        <artifactId>opentelemetry-kafka-clients-2.6</artifactId>
        <version>1.32.0-alpha</version>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-sdk</artifactId>
        <version>1.34.1</version>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry</groupId>
        <artifactId>opentelemetry-exporter-sender-jdk</artifactId>
        <version>1.34.1-alpha</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-netty-shaded</artifactId>
        <version>1.61.0</version>
    </dependency>

  2. 추적 환경 변수를 사용하여 추적 프로그램의 구성을 정의합니다.
  3. 환경 변수로 초기화되는 추적기를 생성합니다.

    OpenTelemetry용 추적기 생성

    OpenTelemetry ot = GlobalOpenTelemetry.get();

  4. 추적기를 글로벌 추적기로 등록합니다.

    GlobalTracer.register(tracer);
  5. 클라이언트를 계측합니다.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동