Skip to content

Add golden e2e tests for ibm-mq-metrics#2119

Open
atoulme wants to merge 2 commits intoopen-telemetry:mainfrom
atoulme:add_golden
Open

Add golden e2e tests for ibm-mq-metrics#2119
atoulme wants to merge 2 commits intoopen-telemetry:mainfrom
atoulme:add_golden

Conversation

@atoulme
Copy link
Contributor

@atoulme atoulme commented Aug 15, 2025

Description:

Test changes to add an e2e test for the ibm-mq-metrics component.

Existing Issue(s):

Fixes #2112

@github-actions github-actions bot requested a review from breedx-splk August 15, 2025 20:10
@atoulme atoulme force-pushed the add_golden branch 4 times, most recently from 2b66a8f to 60da846 Compare August 15, 2025 21:29
@atoulme atoulme force-pushed the add_golden branch 4 times, most recently from d974838 to c4e8ef8 Compare October 9, 2025 06:05
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 14 days.

@github-actions github-actions bot added the stale label Jan 7, 2026
@atoulme atoulme marked this pull request as ready for review January 15, 2026 00:48
@atoulme atoulme requested a review from a team as a code owner January 15, 2026 00:48
@breedx-splk
Copy link
Contributor

@atoulme are you chasing that failure?

Copilot AI review requested due to automatic review settings March 6, 2026 16:21
Copy link
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 “golden” end-to-end (e2e) test setup for the ibm-mq-metrics component to validate emitted OTLP metrics against an expected snapshot, helping prevent regressions (Fixes #2112).

Changes:

  • Adds a docker-compose-based golden test harness (MQ + Collector + Golden) and expected metrics snapshot.
  • Adds a Gradle task to copy the IBM MQ client JAR for use by the golden test runner script.
  • Updates channel metrics collection to honor the ibm.mq.manager.active.channels enablement flag.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ibm-mq-metrics/src/main/java/io/opentelemetry/ibm/mq/metricscollector/ChannelMetricsCollector.java Gates activeChannelsGauge emission behind metrics config.
ibm-mq-metrics/build.gradle.kts Adds copyIbmClientJar task to place MQ client JAR in build/libs.
ibm-mq-metrics/golden/run.sh Runs the built shadow JAR against the golden config.
ibm-mq-metrics/golden/otelconf.yaml Collector config for receiving OTLP and exporting to the golden verifier.
ibm-mq-metrics/golden/docker-compose.yaml Brings up MQ, collector, and golden verifier containers.
ibm-mq-metrics/golden/data/expected.yaml Golden expected metrics snapshot.
ibm-mq-metrics/golden/config.yml IBM MQ metrics app config used for the golden run.
.github/workflows/e2e.yml GitHub Actions workflow to run the golden e2e test on changes.

otlpExporter:
otel.metric.export.interval: 20s
otel.exporter.otlp.protocol: http/protobuf
otel.exporter.otlp.endpoint: http://0.0.0.0:4318
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

otel.exporter.otlp.endpoint: http://0.0.0.0:4318 uses a wildcard address that’s meant for servers to bind to, not for clients to connect to. To reliably reach the collector from the host-run Java process, set this to http://localhost:4318 (consistent with ibm-mq-metrics/config.yml).

Suggested change
otel.exporter.otlp.endpoint: http://0.0.0.0:4318
otel.exporter.otlp.endpoint: http://localhost:4318

Copilot uses AI. Check for mistakes.
set -eux

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
jar=$(find "$SCRIPT_DIR/../build/libs" -name "opentelemetry-ibm-mq-metrics-*-all.jar")
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

jar=$(find ...) can expand to multiple paths (or an empty string) and then produce an invalid classpath that’s hard to diagnose. Consider making the selection deterministic (e.g., constrain find to a single result) and explicitly fail with a clear error if no shadow JAR is found.

Suggested change
jar=$(find "$SCRIPT_DIR/../build/libs" -name "opentelemetry-ibm-mq-metrics-*-all.jar")
jar=$(find "$SCRIPT_DIR/../build/libs" -maxdepth 1 -name "opentelemetry-ibm-mq-metrics-*-all.jar" -print -quit)
if [[ -z "$jar" ]]; then
echo "Error: Shadow JAR not found in $SCRIPT_DIR/../build/libs (expected opentelemetry-ibm-mq-metrics-*-all.jar)" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +10
- ibm-mq-metrics/**
pull_request:
paths:
- ibm-mq-metrics/**
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

The workflow is restricted to paths: ibm-mq-metrics/**, so changes to .github/workflows/e2e.yml itself won’t trigger a run unless some ibm-mq-metrics/** file also changes. Add the workflow file path (or .github/workflows/**) to the paths filter to ensure workflow edits are validated in PRs.

Suggested change
- ibm-mq-metrics/**
pull_request:
paths:
- ibm-mq-metrics/**
- ibm-mq-metrics/**
- .github/workflows/e2e.yml
pull_request:
paths:
- ibm-mq-metrics/**
- .github/workflows/e2e.yml

Copilot uses AI. Check for mistakes.

queueManagers:
- name: "QM1"
host: "0.0.0.0"
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

host: "0.0.0.0" is a bind-all address and is not a valid/portable target for an outbound client connection. Since ibm-mq-metrics/config.yml uses localhost, the golden config should also use localhost (or 127.0.0.1) so the runner process can reliably connect to the MQ container via the published port.

Suggested change
host: "0.0.0.0"
host: "localhost"

Copilot uses AI. Check for mistakes.
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] Add golden files testing

3 participants