Skip to content

Add metric ibm_mq.channel.conns to ibm mq integration, add channel and connection metric tests #20519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mwdd146980
Copy link
Contributor

@mwdd146980 mwdd146980 commented Jun 15, 2025

What does this PR do?

This PR adds a new metric ibm_mq.channel.conns to the IBM MQ integration. This metric is a gauge that indicates active connections per channel, with a value of 1 for each active connection. It is tagged with both the channel name and connection information, allowing users to monitor which specific connections are active for each channel.

Additionally, this PR significantly enhances the test coverage for channel and connection metrics by:

  1. Adding comprehensive unit tests for channel connection handling in test_channel_metric_collector.py
  2. Testing various connection scenarios including:
    • Channels with active connections
    • Channels without connections
    • Channels with empty connection strings
      Proper tagging of connection metrics
  3. Ensuring proper metric collection and tagging for the new connection metric
  4. Verifying that connection metrics are properly aggregated and reported

Motivation

The motivation behind this PR is to enhance the monitoring capabilities of the IBM MQ integration by providing visibility into active connections per channel. This feature allows users to track connection changes over time and identify which connections are active, which is crucial for maintaining the health and performance of the messaging system.

This was requested in escalation AGENT-13489/FRAGENT-3166 by customer Broadridge (GTO) (org ID: 345886).

Manual QA Steps

  • Spin up an EC2 VM with AMI Ubu-ddev-docker (required for the correct architecture)
  • Install IBM MQ server and client libraries
  • Run pytest tests/test_ibm_mq_unit.py -v

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • [not applicable] If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@mwdd146980 mwdd146980 force-pushed the mwdd146980/fragent-3166-channel-conns-metric branch from 8fe0745 to 290b3e5 Compare June 16, 2025 03:35
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.12%. Comparing base (7260dae) to head (613dafb).
Report is 21 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
confluent_platform ?
falco ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
kuma ?
litellm ?
presto ?
solr ?
tomcat ?
weblogic ?

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Update channel metric collector to use channel_status_metrics() instead of channel_metrics()
  for discovered channels to properly collect buffers_rcvd metric
- Update test assertions to match actual tags being sent in gauge calls
- Fix unit tests in test_channel_metric_collector.py to pass

This change ensures that channel status metrics like buffers_rcvd are properly
collected and reported by the integration.
- Updated get_pcf_channel_metrics to submit configuration metrics instead of status metrics.
- Modified unit tests to verify that configuration metrics are collected for channels with empty or no connections.
- Added a new test test_channel_status_metrics to ensure status metrics and connection metrics are correctly submitted.
connection_name = to_string(channel_info[pymqi_type]).strip()
if not connection_name:
continue
connection_tags = tags + ["connection:{}".format(connection_name)]
Copy link
Contributor

Choose a reason for hiding this comment

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

The connection tag, is there any chance it can be unbounded? Or what does a connection look like?

ibm_mq.channel.bytes_sent,gauge,,byte,,This attribute specifies the number of bytes sent (parameter identifier: `MQIACH_BYTES_SENT`).,0,ibm_mq,bytes sent,,
ibm_mq.channel.channel_status,gauge,,,,This attribute specifies the channel status (parameter identifier: `MQIACH_CHANNEL_STATUS`).,0,ibm_mq,channel status,,
ibm_mq.channel.channels,gauge,,resource,,The number of active channels.,0,ibm_mq,active channel count,,
ibm_mq.channel.conns,gauge,,connection,,The number of connections to the channel (parameter identifier: `MQIACH_CONNS`).,0,ibm_mq,conns,,
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems more like a con.status metric to me. Each connection will have a status and report 1 as a gauge, rather than a sum of the conns.

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

Successfully merging this pull request may close these issues.

3 participants