Skip to content

feat(ibm-mq-metrics): report queue manager uptime (#2823)#2835

Open
harshitt13 wants to merge 3 commits into
open-telemetry:mainfrom
harshitt13:feat/ibm-mq-uptime-2823
Open

feat(ibm-mq-metrics): report queue manager uptime (#2823)#2835
harshitt13 wants to merge 3 commits into
open-telemetry:mainfrom
harshitt13:feat/ibm-mq-uptime-2823

Conversation

@harshitt13
Copy link
Copy Markdown

@harshitt13 harshitt13 commented May 14, 2026

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.

  • Added ibm_mq.queue_manager.uptime metric (Gauge, seconds) calculating uptime from PCF attributes CMQCFC.MQCACF_Q_MGR_START_DATE and CMQCFC.MQCACF_Q_MGR_START_TIME.
  • Eliminated timezone drift by securely anchoring the parsed IBM MQ local time to ZoneOffset.UTC.
  • Enabled the new metric in the default configuration.
  • Deprecated the existing heartbeat metric per the issue discussion, keeping it active with @SuppressWarnings during the transition period so users aren't immediately broken.

Existing Issue(s):

Fixes #2823

Testing:

  • Updated QueueManagerMetricsCollectorTest to inject mock start dates/times into the PCF response and verify the new gauge emission.
  • Created MessageBuddyTest to explicitly verify that the uptime calculation remains perfectly stable regardless of the collector host's underlying JVM default timezone.
  • Executed ./gradlew :ibm-mq-metrics:generateWeaver and verified existing module tests pass cleanly.

Documentation:

  • Updated model/metrics.yaml and config.yml to define and enable the new ibm_mq.queue_manager.uptime metric.
  • Added standard Java @Deprecated annotations and Javadoc for the heartbeat metric.

Outstanding items:

  • The heartbeat metric is currently deprecated but still emitting. It will need to be completely removed in a future major release.

Signed-off-by: Harshit Kushwaha <find.harshitkushwaha@gmail.com>
Copilot AI review requested due to automatic review settings May 14, 2026 15:42
@harshitt13 harshitt13 requested a review from a team as a code owner May 14, 2026 15:42
@github-actions github-actions Bot requested review from atoulme and breedx-splk May 14, 2026 15:43
Copy link
Copy Markdown
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

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 new MessageBuddy.queueManagerUptime helper, and emits the value in QueueManagerMetricsCollector.
  • Marks Metrics.createIbmMqHeartbeat as @Deprecated and wraps its consumer in WmqMonitor with @SuppressWarnings("OtelDeprecatedApiUsage").
  • Updates model/metrics.yaml with the new metric definition and a deprecation note on ibm.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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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>
Comment thread ibm-mq-metrics/model/metrics.yaml Outdated
Comment thread ibm-mq-metrics/model/metrics.yaml Outdated
…ime counter and update related metrics

Signed-off-by: Harshit Kushwaha <find.harshitkushwaha@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ibm-mq-metrics] Report queue manager uptime

3 participants