Add golden e2e tests for ibm-mq-metrics#2119
Add golden e2e tests for ibm-mq-metrics#2119atoulme wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
2b66a8f to
60da846
Compare
d974838 to
c4e8ef8
Compare
|
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. |
|
@atoulme are you chasing that failure? |
There was a problem hiding this comment.
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.channelsenablement 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 |
There was a problem hiding this comment.
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).
| otel.exporter.otlp.endpoint: http://0.0.0.0:4318 | |
| otel.exporter.otlp.endpoint: http://localhost:4318 |
| 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") |
There was a problem hiding this comment.
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.
| 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 |
| - ibm-mq-metrics/** | ||
| pull_request: | ||
| paths: | ||
| - ibm-mq-metrics/** |
There was a problem hiding this comment.
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.
| - 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 |
|
|
||
| queueManagers: | ||
| - name: "QM1" | ||
| host: "0.0.0.0" |
There was a problem hiding this comment.
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.
| host: "0.0.0.0" | |
| host: "localhost" |
Description:
Test changes to add an e2e test for the ibm-mq-metrics component.
Existing Issue(s):
Fixes #2112