Skip to content

Conversation

@Alexander-Cairns
Copy link
Contributor

@Alexander-Cairns Alexander-Cairns commented Nov 14, 2025

Summary by CodeRabbit

Release Notes

  • New Features
    • Prometheus JMX exporter integration now available in Docker image
    • ActiveMQ broker metrics exposed on port 3001 for monitoring integration
    • Comprehensive metric collection rules for queues, topics, and broker health monitoring

@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Walkthrough

This PR integrates Prometheus JMX exporter into the ActiveMQ Docker image. It adds JMX agent JAR download with checksum verification, creates a jmx.yml configuration file defining metric collection rules, and configures the environment to expose metrics on port 3001 while excluding JMX from health checks.

Changes

Cohort / File(s) Summary
JMX Exporter Integration
Dockerfile
Adds build-time ARGs for JMX exporter version and digest; downloads jmx_prometheus_javaagent JAR; copies jmx.yml configuration; sets JMX_OPT environment variable with agent port 3001; switches user to activemq and updates working directory.
JMX Exporter Integration
healthcheck.sh
Strips JMX_OPT from ACTIVEMQ_OPTS before executing health query; adds comment to clarify JMX exporter exclusion from healthcheck.
JMX Exporter Integration
jmx.yml
New configuration file for JMX metrics export; enables lowercase output for metric names; defines metric collection rules for ActiveMQ broker attributes (queues, topics, connections, usage percentages) with regex-based name derivation, type specification (GAUGE, COUNTER), and label extraction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Dockerfile checksum and digest verification: Verify that JMX_EXPORTER_DIGEST and checksum are correct and properly validated during build
  • jmx.yml metric rules: Review regex patterns, metric naming conventions, type specifications (GAUGE/COUNTER), and valueFactor multipliers for accuracy
  • Environment variable handling: Confirm ACTIVEMQ_OPTS and JMX_OPT integration does not introduce side effects in other initialization paths

Poem

🐰 A metrics tale, with whiskers bright,
JMX exporter shines with Prometheus light,
Queues and topics dance in YAML's grace,
Healthcheck hops, leaving JMX out of place! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'SEC-1601: jvm metrics' is vague and generic, using broad terms like 'jvm metrics' without specifying the actual change. The PR adds Prometheus JMX exporter integration to ActiveMQ, which is more specific than the generic 'jvm metrics' descriptor. Consider a more descriptive title like 'Add Prometheus JMX exporter integration to ActiveMQ Docker image' or 'Enable JMX metrics export via Prometheus agent' to better convey the main change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SEC-1601

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Alexander-Cairns Alexander-Cairns added the minor Added functionality that is backwards compatible. label Nov 14, 2025
@Alexander-Cairns Alexander-Cairns marked this pull request as ready for review November 14, 2025 20:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Dockerfile (1)

10-10: Port 3001 (JMX metrics) is not exposed.

The JMX exporter is configured to run on port 3001 (line 46) but the EXPOSE statement does not include it. Metrics will be unreachable from outside the container.

Add port 3001 to the EXPOSE statement:

-EXPOSE 8161 61613 61616
+EXPOSE 8161 61613 61616 3001
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3ba3bb1 and b2e1ee7.

📒 Files selected for processing (3)
  • Dockerfile (1 hunks)
  • healthcheck.sh (1 hunks)
  • jmx.yml (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.11.0)
healthcheck.sh

[warning] 4-4: In POSIX sh, string replacement is undefined.

(SC3060)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build / build-push
🔇 Additional comments (2)
jmx.yml (1)

1-36: Verify jmx_exporter configuration against actual ActiveMQ MBean names.

The configuration looks structurally sound for Prometheus JMX exporter, but the regex patterns should be validated against actual ActiveMQ broker MBean attribute names to ensure they correctly match and extract metrics.

To verify the patterns work correctly, confirm:

  • ActiveMQ broker exposes MBeans matching org.apache.activemq:type=Broker,brokerName=*
  • Queue/topic destination names match the pattern separators (spaces after commas in line 12, 18)
  • The valueFactor: 0.01 correctly converts percent usage to 0–1 range

If you have access to a running ActiveMQ instance, you can verify the MBean names by inspecting JMX metrics. Alternatively, consult the jmx_prometheus_exporter documentation to confirm the pattern syntax (particularly the angle bracket format <type=Broker, ...><> on lines 12, 18, etc.).

Dockerfile (1)

35-43: Based on my verification:

Update Dockerfile to use the latest JMX exporter version 1.5.0 and verify the digest.

Version 1.4.0 was released Aug 25, 2025, but version 1.5.0 (published Oct 7, 2025) is the latest release. While 1.4.0 is technically valid, using an outdated version introduces maintenance risk. GitHub Release page hosts the JARs (collector jar no longer published to Maven Central).

Manually verify the SHA256 digest db1492e95a7ee95cd5e0a969875c0d4f0ef6413148d750351a41cc71d775f59a matches the official GitHub release artifact for version 1.4.0 before proceeding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Added functionality that is backwards compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants