Skip to content

[Kafka instrumentation] "Instrument has recorded multiple values for the same attributes" with version 2.7.0 #12199

Closed
@gaeljw

Description

@gaeljw

Describe the bug

When upgrading from opentelemetry-instrumentation-bom-alpha version 2.6.0 to 2.7.0, we encounter a lot of WARN messages like the following:

Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:619 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_throttle_time_avg has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:620 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_throttle_time_max has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:620 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_latency_avg has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:620 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_latency_max has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.fetch_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.connection_close_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.connection_close_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.connection_creation_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.connection_creation_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.successful_authentication_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.successful_authentication_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.successful_reauthentication_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:621 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.successful_reauthentication_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:622 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.successful_authentication_no_reauth_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:622 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.failed_authentication_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:622 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.failed_authentication_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:622 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.failed_reauthentication_total has recorded multiple values for the same attributes: {client-id="my_app_0"}
Sep 10 07:48:44 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:44:622 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument kafka.consumer.failed_reauthentication_rate has recorded multiple values for the same attributes: {client-id="my_app_0"}

And at some point it even says:

Sep 10 07:48:50 srv-xx sh[66538]: [otel.javaagent 2024-09-10 07:48:50:819 +0000] [prometheus-http-1-1] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Too many log messages detected. Will only log once per minute from now on.

Steps to reproduce

I don't have a reproduction repository for now but I may provide one later if needed.

On our side, this happens with an application that has a very basic Kafka consumer, automatic instrumentation using the java agent and the following OTEL config:

OTEL_SERVICE_NAME="my-app"
OTEL_METRICS_EXPORTER=prometheus
OTEL_EXPORTER_PROMETHEUS_PORT=19002
# Traces=disabled
OTEL_TRACES_EXPORTER=none
# Logs=disabled
OTEL_LOGS_EXPORTER=none

This happens with kafka-clients library 3.7.1 and 3.8.0 (we didn't test previous versions). Seems unrelated to the kafka client library.

Expected behavior

No such warnings.

Moreover these logs are sent to stdout (/var/log/messages in our case) for some reason instead of being sent to the logging library. I'm not sure if this is expected and/or related.

Actual behavior

Continuous warning logs.

Javaagent or library instrumentation version

2.7.0

Environment

JDK: 17.0.12
OS: Linux (AlmaLinux release 8.10)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions