Skip to content

No traces exported for Apache ZooKeeper #13792

@NickLarsenNZ

Description

@NickLarsenNZ

Describe the bug

No traces are emitted when instrumenting ZooKeeper (3.9.3).

I can see metrics and logs in the console (if I set the exporter to console), and I would expect the same for traces.
I have tried both console and otlp (via the otel-collector with debugging for received traces enabled) exporters.

Am I holding it wrong, or is there something fundamentally different about ZooKeeper?

Steps to reproduce

To reproduced minimally:

  1. Download the javaagent
    curl -LO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.15.0/opentelemetry-javaagent.jar
  2. Run the docker-compose below
    docker compose up
  3. Observe that no traces appear.
    You can enable the metrics/logs exporter to ensure things are happening within the application.
version: '3.1'

services:
  zoo1:
    image: zookeeper:3.9.3
    restart: always
    hostname: zoo1
    ports:
      - 2181:2181
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
      JAVA_TOOL_OPTIONS: -javaagent:/otel-auto-instrumentation-java/javaagent.jar
      OTEL_SERVICE_NAME: zookeeper
      OTEL_RESOURCE_ATTRIBUTES: service.name=zookeeper # in case OTEL_SERVICE_NAME doesn't work
      OTEL_EXPORTER_OTLP_ENDPOINT: http://collector:4317
      OTEL_EXPORTER_OTLP_PROTOCOL: grpc
      OTEL_METRICS_EXPORTER: none # console
      OTEL_LOGS_EXPORTER: none # console
      OTEL_TRACES_EXPORTER: console # otlp
      OTEL_INSTRUMENTATION_JETTY_ENABLED: "true"
    volumes:
      - ./opentelemetry-javaagent.jar:/otel-auto-instrumentation-java/javaagent.jar

  zoo2:
    image: zookeeper:3.9.3
    restart: always
    hostname: zoo2
    ports:
      - 2182:2181
    environment:
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
      JAVA_TOOL_OPTIONS: -javaagent:/otel-auto-instrumentation-java/javaagent.jar
      OTEL_SERVICE_NAME: zookeeper
      OTEL_RESOURCE_ATTRIBUTES: service.name=zookeeper # in case OTEL_SERVICE_NAME doesn't work
      OTEL_EXPORTER_OTLP_ENDPOINT: http://collector:4317
      OTEL_EXPORTER_OTLP_PROTOCOL: grpc
      OTEL_METRICS_EXPORTER: none # console
      OTEL_LOGS_EXPORTER: none # console
      OTEL_TRACES_EXPORTER: console # otlp
      OTEL_INSTRUMENTATION_JETTY_ENABLED: "true"
    volumes:
      - ./opentelemetry-javaagent.jar:/otel-auto-instrumentation-java/javaagent.jar

  zoo3:
    image: zookeeper:3.9.3
    restart: always
    hostname: zoo3
    ports:
      - 2183:2181
    environment:
      ZOO_MY_ID: 3
      ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
      JAVA_TOOL_OPTIONS: -javaagent:/otel-auto-instrumentation-java/javaagent.jar
      OTEL_SERVICE_NAME: zookeeper
      OTEL_RESOURCE_ATTRIBUTES: service.name=zookeeper # in case OTEL_SERVICE_NAME doesn't work
      OTEL_EXPORTER_OTLP_ENDPOINT: http://collector:4317
      OTEL_EXPORTER_OTLP_PROTOCOL: grpc
      OTEL_METRICS_EXPORTER: none # console
      OTEL_LOGS_EXPORTER: none # console
      OTEL_TRACES_EXPORTER: console # otlp
      OTEL_INSTRUMENTATION_JETTY_ENABLED: "true"
    volumes:
      - ./opentelemetry-javaagent.jar:/otel-auto-instrumentation-java/javaagent.jar

I have also tried explicitly enabling instrumentations, eg: OTEL_INSTRUMENTATION_JETTY_ENABLED=true (I have seen some mention of Jetty in the logs, so assumed that might have been a good test case).

Expected behavior

Traces to be periodically emitted to the console (or to the collector if I enable export via otlp).

Actual behavior

Silence (but I can see logs and metrics emitted via the agent if I enable the exporter (both console and otlp).

Javaagent or library instrumentation version

v2.15.0

Environment

JDK: Temurin 17
OS: NixOS (linux x86)

Additional context

I have instrumented a few other apps using this javaagent (NiFi, HBase, HDFS), and they have so far emitted traces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcomeenhancementNew feature or requestneeds author feedbackWaiting for additional feedback from the authornew instrumentationstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions