Skip to content

feat(metrics): add Prometheus metrics support with endpoint and configuration - #435

Open
matheusandre1 wants to merge 1 commit into
devops-thiago:mainfrom
matheusandre1:issue-44
Open

feat(metrics): add Prometheus metrics support with endpoint and configuration#435
matheusandre1 wants to merge 1 commit into
devops-thiago:mainfrom
matheusandre1:issue-44

Conversation

@matheusandre1

Copy link
Copy Markdown
Contributor
  • 🐛 Bug fix
  • ✨ Feature
  • 📝 Documentation
  • 🔧 Refactor
  • 🚀 Performance
  • ✅ Test
  • 🔒 Security
  • 📦 Dependency update
  • 🏗️ CI/CD
  • [ ]

Related Issues

Closes: #44

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review of my own code
  • 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
  • I have updated the documentation accordingly
  • My changes generate no new warnings or errors

@thrillhousebot

Copy link
Copy Markdown

🤖 ThrillhouseBot PR Summary

What this PR does

Adds a GET /metrics endpoint serving OpenTelemetry metrics in Prometheus text format, along with a new counter for completed/failed reviews, configuration for enabling/disabling, and integration tests.

Control-Flow Diagram

🔀 Show diagram
flowchart TD
  A["ReviewOrchestrator.applyReviewResult()"] --> B["ReviewOutcomeMetrics.recordCompleted()"]
  A2["ReviewOrchestrator.applyReviewFailure()"] --> B2["ReviewOutcomeMetrics.recordFailed()"]
  C["HTTP GET /metrics"] --> D["PrometheusMetricsResource.scrape()"]
  D --> E{"reader present?"}
  E -- yes --> F["collect and write Prometheus format"]
  E -- no --> G["return 404"]
Loading

Changes Overview

  • Files changed: 14
  • Lines added: +439
  • Lines removed: -2

Changed Files

File Change Summary
.env.example Modified Added commented OTEL_EXPORTER_ENDPOINT and PROMETHEUS_METRICS_ENABLED with guidance.
CHANGELOG.md Modified Added entry for Prometheus metrics endpoint.
README.md Modified Updated documentation for new config keys and Prometheus endpoint.
src/main/java/dev/thiagogonzaga/thrillhousebot/config/ThrillhouseConfig.java Modified Added MetricsConfig sub-interface with prometheus-enabled flag.
src/main/java/dev/thiagogonzaga/thrillhousebot/observability/PrometheusMetricsRegistrar.java Added CDI bean that conditionally registers a PrometheusMetricReader with the OTel SDK; provides optional reader for the scrape endpoint.
src/main/java/dev/thiagogonzaga/thrillhousebot/observability/PrometheusMetricsResource.java Added JAX-RS resource exposing GET /metrics that returns Prometheus text format or 404 if disabled.
src/main/java/dev/thiagogonzaga/thrillhousebot/observability/ReviewOutcomeMetrics.java Added Application-scoped bean recording a counter for completed/failed reviews via OpenTelemetry.
src/main/java/dev/thiagogonzaga/thrillhousebot/review/ReviewOrchestrator.java Modified Inject ReviewOutcomeMetrics and record completed/failed outcomes after review result application.
src/main/resources/application.properties Modified Enable OpenTelemetry metrics export and define thrillhousebot.metrics.prometheus-enabled property.
src/test/java/dev/thiagogonzaga/thrillhousebot/observability/PrometheusMetricsEndpointDisabledTest.java Added Integration test confirming /metrics returns 404 when OTel SDK is disabled.
src/test/java/dev/thiagogonzaga/thrillhousebot/observability/PrometheusMetricsEndpointTest.java Added Quarkus integration test that starts app with SDK enabled and asserts /metrics returns recorded metrics.
src/test/java/dev/thiagogonzaga/thrillhousebot/observability/PrometheusMetricsResourceTest.java Added Unit test exercising registrar and resource against a real OpenTelemetry SDK; verifies Prometheus text output.
src/test/java/dev/thiagogonzaga/thrillhousebot/review/ReviewOrchestratorTest.java Modified Inject no-op ReviewOutcomeMetrics to satisfy new constructor parameter.

…and 1 more file(s).

Risk Assessment

Risk Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🔵 Low 0

No new issues found in this PR, but the review cannot be approved until required CI is confirmed green.

⚠️ Required CI Checks Status

Some required checks are still pending or have failed:

Check Type Status Detail
format missing ⏳ Pending -
test missing ⏳ Pending -
frontend missing ⏳ Pending -
trivy missing ⏳ Pending -
dependency-review missing ⏳ Pending -

Automated review by ThrillhouseBot. Reply with /review to re-run.

@thrillhousebot thrillhousebot Bot added enhancement New feature or request java Pull requests that update java code testing Test coverage and test quality labels Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update java code testing Test coverage and test quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(observability): expose a Prometheus metrics endpoint

1 participant