Skip to content

Conversation

@germanosin
Copy link
Member

  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

What changes did you make? (Give an overview)

Is there anything you'd like reviewers to focus on?

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)

@germanosin germanosin requested a review from a team as a code owner December 1, 2025 16:17
@kapybro kapybro bot added status/triage Issues pending maintainers triage status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Dec 1, 2025
@germanosin germanosin requested a review from Copilot December 1, 2025 16:25
Copilot finished reviewing on behalf of germanosin December 1, 2025 16:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Prometheus metrics endpoint by correcting the content type from OpenMetrics to Prometheus format and adds defensive logic to prevent label duplication with appropriate warnings.

  • Changed the HTTP response content type from OpenMetricsTextFormatWriter.CONTENT_TYPE to PrometheusTextFormatWriter.CONTENT_TYPE for the /metrics endpoint
  • Added duplicate label detection in MetricsUtils.extendLabels() that logs a warning and preserves the original label value when duplicates are encountered
  • Introduced integration test for the Prometheus metrics endpoint with JMX-enabled Kafka container configuration

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
api/src/main/java/io/kafbat/ui/service/metrics/prometheus/PrometheusMetricsExposer.java Changed content type header from OpenMetrics to Prometheus format
api/src/main/java/io/kafbat/ui/util/MetricsUtils.java Added label duplication check with warning log before extending labels
api/src/test/java/io/kafbat/ui/controller/PrometheusExposeControllerTest.java Added integration test for Prometheus metrics endpoint
api/src/test/java/io/kafbat/ui/AbstractIntegrationTest.java Configured JMX port exposure and Prometheus metrics settings for test cluster

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@germanosin germanosin merged commit bfa01dc into main Dec 1, 2025
13 of 14 checks passed
@germanosin germanosin deleted the fix_label_duplicate branch December 1, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/triage/completed Automatic triage completed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants