Sitelet https://github.com/DataDog/dd-trace-java/pull/12282
Skip to content

Add smoke tests documentation - #12282

Open
PerfectSlayer wants to merge 2 commits into
masterfrom
bbujon/smoke-tests-documentation
Open

Add smoke tests documentation#12282
PerfectSlayer wants to merge 2 commits into
masterfrom
bbujon/smoke-tests-documentation

Conversation

@PerfectSlayer

Copy link
Copy Markdown
Collaborator

What Does This Do

This PR introduces documentation for the new smoke test framework.

Motivation

Help with discovery and adoption.

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@PerfectSlayer
PerfectSlayer requested a review from a team as a code owner August 25, 2026 11:46
@PerfectSlayer
PerfectSlayer requested review from mcculls and removed request for a team August 25, 2026 11:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e352616c17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/how_to_smoke_test.md
## Adding a new smoke-test module

1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list).
2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the smoke-test convention plugin

When a new module follows this recipe, the listed plugins omit dd-trace-java.module.smoke-test, even though that convention applies the repository's Java and test configuration, including JUnit Platform setup. The parent dd-smoke-tests/build.gradle only configures existing Test tasks and does not apply the convention to subprojects, so a JUnit 5 smoke test created from these instructions can be undiscovered or otherwise misconfigured; include the convention plugin in the required plugin list.

Useful? React with 👍 / 👎.

Comment thread docs/how_to_smoke_test.md
3. Write the application fixture under `src/main/java`, and the test under `src/test/java`.
4. Refresh the module's `gradle.lockfile`.

The parent `dd-smoke-tests/build.gradle` already gives every subproject the agent jar, the build directory and the `:dd-smoke-tests` framework, so do not re-declare those.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require the framework dependency in each subproject

The parent dd-smoke-tests/build.gradle supplies the agent-jar and build-directory properties, but it does not add testImplementation project(':dd-smoke-tests') to subprojects. Therefore the claim that the parent provides the framework contradicts step 2 and may lead readers to remove or omit the dependency, leaving classes such as SmokeServerApp unavailable; restrict this sentence to the two system properties and keep the framework dependency explicit.

Useful? React with 👍 / 👎.

Comment thread docs/how_to_smoke_test.md
Comment on lines +71 to +74
span()
.operationName("spring.handler")
.resourceName("MyController.success")
.childOfPrevious()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Match the Spring handler span type

For the Spring MVC application represented by this example, a spring.handler span has the web span type, but an omitted SpanMatcher.type(...) is not a wildcard: SpanMatcher defaults to requiring a null or empty type. Consequently this advertised complete test keeps polling and then fails against a correct trace; add .type("web") to both handler matchers.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That’s not the point of the example… 😞

Comment thread docs/how_to_smoke_test.md
Use `getFlatMessages()` and `waitForFlat(...)` for almost everything.
The tracer batches events, so an `app-started` you are looking for usually arrives nested inside a `message-batch`.

One telemetry assertion runs at the first `afterEach` without you writing it: `assertTelemetryReceived()` checks that at least one message reached the backend.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Qualify the automatic telemetry assertion

When an app uses a separately registered shared backend, AbstractSmokeApp.afterEach explicitly skips assertTelemetryReceived() because backend.isShared() is true. The unconditional statement here can therefore let multi-app tests assume telemetry is validated when no automatic assertion runs; document the owned-backend restriction and direct shared-backend tests to assert through backend.telemetry() themselves.

Useful? React with 👍 / 👎.

Comment thread docs/how_to_smoke_test.md
## Adding a new smoke-test module

1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list).
2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Configure an entry point for the fixture jar

Following this module recipe leaves the application plugin's mainClass unset and does not add a Main-Class manifest attribute. The resulting shadowJar is therefore not a runnable fixture for SmokeServerApp.jar(...) or SmokeCliApp.jar(...), and the child JVM exits immediately when launched with java -jar; include an application { mainClass = ... } block or equivalent manifest configuration.

Useful? React with 👍 / 👎.

Comment thread docs/how_to_smoke_test.md
Comment thread docs/how_to_smoke_test.md
Comment on lines +398 to +400
| `allowedErrorLogs("...")` | One test's known-noisy lines, matched by substring |
| `errorLogFilter(predicate)` | Full control over what counts as an error; replaces the allowlist |
| `skipErrorLogCheck()` | Tests that are *about* error cases |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat error-log exemptions as class-wide

These are builder settings on the static app extension, and the automatic assertNoErrorLogs() scans the entire log accumulated since class launch at afterAll; none of these options can be scoped to one test method. Using allowedErrorLogs(...) or skipErrorLogCheck() for a single error-case method therefore suppresses matching failures from every other method in the class, so describe them as suite-wide and advise isolating such cases in a separate class or performing explicit log assertions.

Useful? React with 👍 / 👎.

@dd-octo-sts

dd-octo-sts Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.99 s 14.01 s [-1.0%; +0.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.94 s 12.98 s [-1.0%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.37 s 17.22 s [-0.2%; +1.9%] (no difference)
startup:petclinic:iast:Agent 16.86 s 17.47 s [-7.7%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.83 s 17.19 s [-6.5%; +2.3%] (no difference)
startup:petclinic:sca:Agent 17.38 s 17.24 s [-0.2%; +1.9%] (no difference)
startup:petclinic:tracing:Agent 16.16 s 16.32 s [-7.0%; +4.9%] (unstable)

Commit: e352616c · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot 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.

Datadog Autotest: FAIL

The new module recipe does not work as written. The guide also says that telemetry checks always run, but the code skips them for shared backends and apps without the agent.

Open Bits AI session

🤖 Datadog Autotest · Commit e352616 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread docs/how_to_smoke_test.md
## Adding a new smoke-test module

1. Register it in `settings.gradle.kts` (the `:dd-smoke-tests:*` list).
2. Create `dd-smoke-tests/<name>/build.gradle` with the `application` and `com.gradleup.shadow` plugins, `testImplementation project(':dd-smoke-tests')`, and a `Test` task that publishes the app fixture:

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.

P2 Complete the Gradle module recipe

Contributors cannot create a working smoke-test module from this recipe.

Assertion details
  • Input: A contributor copies step 2 to create a module that starts its fixture with .jar(APPLICATION_JAR).
  • Expected: The recipe must include the convention plugin, the ShadowJar import, and an executable main-class configuration.
  • Actual: The recipe omits the smoke-test convention plugin and the ShadowJar import. It also does not configure a main class for the fixture that SmokeServerApp.jar(...) starts with java -jar. The copied script fails during Gradle configuration or produces a jar that cannot start.

Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread docs/how_to_smoke_test.md
Use `getFlatMessages()` and `waitForFlat(...)` for almost everything.
The tracer batches events, so an `app-started` you are looking for usually arrives nested inside a `message-batch`.

One telemetry assertion runs at the first `afterEach` without you writing it: `assertTelemetryReceived()` checks that at least one message reached the backend.

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.

P2 State the telemetry check limits

A test can omit telemetry validation while its author believes that the framework performs it.

Assertion details
  • Input: A smoke test uses a shared backend or calls noAgent().
  • Expected: The guide must state that the automatic check runs only for an agent-instrumented app with an owned backend. Other cases need an explicit assertion.
  • Actual: AbstractSmokeApp.afterEach skips this assertion when the backend is shared or when the app has no agent.

Was this helpful? React 👍 or 👎
🤖 Datadog Autotest · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Base automatically changed from bbujon/smoke-tests-dynamic-config to master August 25, 2026 13:16
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot requested review from claponcet, manuel-alvarez-alvarez and mhdatie and removed request for a team August 25, 2026 13:16
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.

1 participant