Skip to content

Apply exclude filters when sending the PCF message to query queues - #3231

Open
atoulme wants to merge 1 commit into
open-telemetry:mainfrom
atoulme:exclude_filters
Open

atoulme wants to merge 1 commit into
open-telemetry:mainfrom
atoulme:exclude_filters

Conversation

@atoulme

@atoulme atoulme commented Nov 19, 2026

Copy link
Copy Markdown
Member

Description:

We currently send a PCF message with our inclusion pattern, and exclude after the fact based on results. It appears MQ can also take an exclusion filter as an additional parameter to the PCF message.

@atoulme
atoulme requested a review from a team as a code owner November 19, 2026 08:17
Copilot AI balanced review requested due to automatic review settings November 19, 2026 08:17
@github-actions
github-actions Bot requested a review from breedx-splk November 19, 2026 08:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Queue metrics collection is blocked by invalid MQ inquiries that add multiple FilterCommands and apply a list-exclusion operator to scalar queue names.

2 open issues
What changed in this PR

This PR aims to reduce IBM MQ queue-query results by sending configured exclusions in PCF requests, rather than relying solely on response-side filtering.

Changes:

  • Adds exclusion parameters to MQCMD_INQUIRE_Q requests.
  • Translates configured match types into operators and wildcard patterns, while retaining existing client-side filtering.
File Description
ibm-mq-metrics/​src/​main/​java/​io/​opentelemetry/​ibm/​mq/​metricscollector/​InquireQCmdCollector.java Builds PCF queue-name filters from configured exclusions.

Review effort: Balanced

Comment on lines +59 to +60
for (ExcludeFilters filter : context.getQueueExcludeFilters()) {
for (String value : filter.getValues()) {

// take the first filter, and apply it, as we can only apply one filter.
if (!context.getQueueExcludeFilters().isEmpty()) {
ExcludeFilters filter = context.getQueueExcludeFilters().iterator().next();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since you have changed this to a list and area already checking non-empty, you shouldn't be using an iterator here. You can just do context.getQueueExcludeFilters().get(0).

request.addParameter(CMQC.MQCA_Q_NAME, queueGenericName);
request.addParameter(CMQC.MQIA_Q_TYPE, CMQC.MQQT_ALL);

// take the first filter, and apply it, as we can only apply one filter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems goofy -- why can we only apply one? The addFilterParameter() method is where the rubber meets the road, and that name suggests you can call it once. Then again, who knows how IBM designed this madness.

Is there a reference somewhere that indicates only one filter?

@breedx-splk breedx-splk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR is missing some tests, especially around the InquireQCmdCollector changes.

This branch has not been deployed

No deployments
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.

3 participants