Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka metrics : label kafka_version=unknown in native mode #40851

Closed
amkac opened this issue May 27, 2024 · 2 comments · Fixed by #41278
Closed

kafka metrics : label kafka_version=unknown in native mode #40851

amkac opened this issue May 27, 2024 · 2 comments · Fixed by #41278

Comments

@amkac
Copy link

amkac commented May 27, 2024

Describe the bug

In native mode only the property 'kafka_version' does not apppear in the kafka_metrics, the value is always UNKNOWN. this issue does not occur in the jvm mode.

Expected behavior

kafka_consumer_successful_authentication_rate{client_id=.... ",kafka_version="3.7.0"} 0.10734796843969728

Actual behavior

kafka_consumer_successful_authentication_rate{client_id=.... ",kafka_version="unknown"} 0.10734796843969728

How to Reproduce?

  1. Build the app in native mode: mvn clean install -Pnative
  2. Search for kafka metrics on /q/metrics

Output of uname -a or ver

No response

Output of java -version

21

Quarkus version or git rev

3.10.2

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.9

Additional information

No response

Copy link

quarkus-bot bot commented May 27, 2024

/cc @alesj (kafka), @cescoffier (kafka), @ebullient (metrics), @jmartisk (metrics), @ozangunalp (kafka), @zakkak (native-image)

@ozangunalp ozangunalp self-assigned this May 27, 2024
@cescoffier
Copy link
Member

Seems to be an issue in the micrometer binder.

The KAfka version is set in:

void prepareToBindMetrics(MeterRegistry registry) {
        this.metrics.set(this.metricsSupplier.get());
        Map<MetricName, ? extends Metric> metrics = this.metrics.get();
        // Collect static metrics and tags
        Metric startTimeMetric = null;

        for (Map.Entry<MetricName, ? extends Metric> entry : metrics.entrySet()) {
            MetricName name = entry.getKey();
            if (METRIC_GROUP_APP_INFO.equals(name.group()))
                if (VERSION_METRIC_NAME.equals(name.name())) {
                    kafkaVersion = (String) entry.getValue().metricValue();
                }
                else if (START_TIME_METRIC_NAME.equals(name.name())) {
                    startTimeMetric = entry.getValue();
                }
        }

        if (startTimeMetric != null) {
            MetricName startTimeMetricName = startTimeMetric.metricName();
            bindMeter(registry, startTimeMetric, meterName(startTimeMetricName), meterTags(startTimeMetricName));
        }
    }

For some reason, there is no version in native ("unknown" is the default one).

@gsmet gsmet closed this as completed in b658288 Jun 18, 2024
@quarkus-bot quarkus-bot bot added this to the 3.13 - main milestone Jun 18, 2024
@gsmet gsmet modified the milestones: 3.13 - main, 3.11.3 Jun 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jun 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jun 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jun 18, 2024
holly-cummins pushed a commit to holly-cummins/quarkus that referenced this issue Jul 31, 2024
@gsmet gsmet modified the milestones: 3.11.3, 3.8.6 Aug 14, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 14, 2024
danielsoro pushed a commit to danielsoro/quarkus that referenced this issue Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants