feat(ibm-mq-metrics): report queue manager uptime (#2823)#2835
feat(ibm-mq-metrics): report queue manager uptime (#2823)#2835harshitt13 wants to merge 3 commits into
Conversation
Signed-off-by: Harshit Kushwaha <find.harshitkushwaha@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds a new ibm.mq.queue_manager.uptime gauge that reports cumulative queue-manager uptime in seconds (derived from PCF MQCA_Q_MGR_START_DATE/MQCA_Q_MGR_START_TIME), and deprecates the existing ibm.mq.heartbeat metric in favor of it.
Changes:
- Adds
Metrics.createIbmMqQueueManagerUptime,MetricsConfig.isIbmMqQueueManagerUptimeEnabled, a newMessageBuddy.queueManagerUptimehelper, and emits the value inQueueManagerMetricsCollector. - Marks
Metrics.createIbmMqHeartbeatas@Deprecatedand wraps its consumer inWmqMonitorwith@SuppressWarnings("OtelDeprecatedApiUsage"). - Updates
model/metrics.yamlwith the new metric definition and a deprecation note onibm.mq.heartbeat.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ibm-mq-metrics/model/metrics.yaml | Declares the new uptime metric and notes deprecation of heartbeat. |
| ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metrics/Metrics.java | Adds the uptime gauge factory and @Deprecated annotation on heartbeat. |
| ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metrics/MetricsConfig.java | Adds an enable flag for the new metric. |
| ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/MessageBuddy.java | Parses PCF start date/time and computes uptime in seconds. |
| ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/QueueManagerMetricsCollector.java | Registers the gauge and emits the new metric inside the collection loop. |
| ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/WmqMonitor.java | Suppresses the deprecation warning for the still-active heartbeat gauge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 895d64f00f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Harshit Kushwaha <find.harshitkushwaha@gmail.com>
…ime counter and update related metrics Signed-off-by: Harshit Kushwaha <find.harshitkushwaha@gmail.com>
Description:
Feature addition - This PR introduces a new metric to report the cumulative uptime of the queue manager in seconds, providing better visibility into queue manager restarts compared to the static heartbeat metric.
ibm_mq.queue_manager.uptimemetric (Gauge, seconds) calculating uptime from PCF attributesCMQCFC.MQCACF_Q_MGR_START_DATEandCMQCFC.MQCACF_Q_MGR_START_TIME.ZoneOffset.UTC.heartbeatmetric per the issue discussion, keeping it active with@SuppressWarningsduring the transition period so users aren't immediately broken.Existing Issue(s):
Fixes #2823
Testing:
QueueManagerMetricsCollectorTestto inject mock start dates/times into the PCF response and verify the new gauge emission.MessageBuddyTestto explicitly verify that the uptime calculation remains perfectly stable regardless of the collector host's underlying JVM default timezone../gradlew :ibm-mq-metrics:generateWeaverand verified existing module tests pass cleanly.Documentation:
model/metrics.yamlandconfig.ymlto define and enable the newibm_mq.queue_manager.uptimemetric.@Deprecatedannotations and Javadoc for theheartbeatmetric.Outstanding items:
heartbeatmetric is currently deprecated but still emitting. It will need to be completely removed in a future major release.