Repository navigation
Internal - Make smoke test detect service entity correlation failures - #681
Merged
Merged
Conversation
…akage The k6 checks used a fixed service name, so stale entities and telemetry from previous runs satisfied them. v3.3.0's entity inference regression went undetected as a result. - Suffix the smoke test service name with the run's UTC start datetime and share it across petclinic (v1 and v2 sdk-config) and k6 - Throw from getEntityId() when the service entity is not found instead of querying logs with an undefined entity id Temporarily re-enable ServiceInstanceIdResourceProvider to verify the smoke test now fails; revert before merging.
ApmResourceProvider runs after the upstream ServiceInstanceIdResourceProvider and its plain service.instance.id attribute strips the upstream service.instance entity during resource merge, so re-enabling the provider alone did not reproduce v3.3.0. Remove it so the entity is exported and the smoke test can be verified against the real breakage; revert before merging.
Metrics were queried by the service.name attribute, which still matches when the backend fails to correlate telemetry to the Service entity. Query by sw.entity.service.id instead, the tag the backend adds once telemetry is correlated, so the checks fail when entity inference breaks. - Resolve the Service entity once per iteration and reuse its id for the metric and log checks - Look up the entity by exact name instead of scanning the first 50 Service entities
Exhausting retries without a positive measurement recorded no check, so the JUnit assertion failed with PathNotFoundException instead of a clear assertion message. Record an explicit failure under the same check name.
…cation Revert the temporary changes that reproduced the v3.3.0 entity inference breakage: disable ServiceInstanceIdResourceProvider again and restore service.instance.id in ApmResourceProvider. The smoke test was confirmed to fail with them in place.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Service names can collide across concurrent test JVMs started in the same UTC second, allowing a healthy release job to satisfy a broken job’s metric and log checks.
1 open issue
What changed in this PR
Strengthens smoke tests to detect failures in backend Service entity correlation, rather than merely checking telemetry resource attributes.
Changes:
- Shares a timestamp-based service name between PetClinic and k6 for each test JVM.
- Resolves the Service entity by exact name and scopes metric and log checks to its ID.
- Records an explicit failed metric check when retries are exhausted.
| File | Description |
|---|---|
| smoke-tests/src/test/java/com/solarwinds/util/ServiceNames.java | Generates the shared timestamp-based service name. |
| smoke-tests/src/test/java/com/solarwinds/containers/PetClinicRestContainer.java | Passes the shared name to both agent configuration variants. |
| smoke-tests/src/test/java/com/solarwinds/containers/K6Container.java | Supplies the shared service name to k6. |
| smoke-tests/sdk-config.yaml | Reads the service name from the environment. |
| smoke-tests/README.md | Documents the new service-name format. |
| smoke-tests/k6/basic.js | Adds exact entity lookup, entity-scoped checks, and explicit metric failure reporting. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
v3.3.0 shipped a change that caused SWO to stop correlating telemetry with the Service entity, and the k6 smoke test did not catch it. This PR makes the smoke test validate correlation from the backend's perspective: each run uses a unique service name, and the metric and log checks are scoped to the Service entity the backend inferred, not to the
service.nameattribute. Verified by reproducing the v3.3.0 behavior on this branch (smoke test fails) and then restoring the fix (smoke test passes).Why the smoke test missed it
Metric checks matched the attribute, not the entity. Metrics were queried with
service.name:"java-apm-smoke-test", which matches the raw resource attribute regardless of correlation.The log check was satisfied by the shared service identity. Every run, on every branch, reported as
java-apm-smoke-test, so the Service entity was long-lived and not tied to the run under test.Changes
java-apm-smoke-test-<yyyyMMdd-HHmmss>(UTC run start). The name is generated once per test JVM and shared by the petclinic container (both theSW_APM_SERVICE_KEYand declarativesdk-config.yamlvariants) and k6. The backend must infer a fresh Service entity on every run, so stale entities and telemetry cannot satisfy the checks.INfilter onnameinstead of scanning the first 50 Service entities. The lookup throws if the entity is not found.sw.entity.service.id:"<entityId>", the tag the backend adds once telemetry is correlated to a Service entity (the same filter the SWO UI uses for a service's metrics). Logs continue to be queried byentityIds, now reusing the resolved id.PathNotFoundException(run 44204822454) instead of its assertion message (run 44212549919).Verification
The branch temporarily reproduced v3.3.0 by re-enabling
ServiceInstanceIdResourceProviderand removingservice.instance.idfromApmResourceProvider. The second change was needed becauseApmResourceProviderruns after the upstream provider; its differingservice.instance.idvalue causes the SDK to drop the upstreamservice.instanceentity during resource merge (logged asRemoving entity association [service.instance]), which masked the regression.SmokeTest)assertThatMetricsAreExportedassertThatRuntimeMetrics17AreExportedassertThatLogsAreExportedA direct query against the broken run's entity showed the failure mode: metrics were present by
service.namebut absent bysw.entity.service.id, and no logs were attached to the entity. The temporary changes are reverted in the last commit.