Skip to content

test(spring-boot): [Sample Tests 37] Move the Boot 4 OTLP sample's tests into the module - #6329

Draft
runningcode wants to merge 2 commits into
no/otlp-integration-testfrom
no/boot4-otlp-integration-test
Draft

runningcode wants to merge 2 commits into
no/otlp-integration-testfrom
no/boot4-otlp-integration-test

Conversation

@runningcode

@runningcode runningcode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

Adds an integrationTestOtlp suite to sentry-spring-boot-4. It's the servlet app with the OpenTelemetry Spring Boot starter, set up by sentry-opentelemetry-otlp-spring, plus the OpenTelemetryOtlpEventProcessor the sample registered. The suite ports sentry-samples-spring-boot-4-otlp's tests.

What the sample's tests really checked. Its tests are the Boot 4 servlet suite's (#6297) minus OkHttp and the log and metric attribute checks. They expect Sentry transactions, but in OTLP mode OpenTelemetry does the tracing and exports it over OTLP. Those transactions came from Sentry's own Spring tracing, which the runner switched on next to OpenTelemetry with SENTRY_TRACES_SAMPLE_RATE=1.0. The sample's application.properties doesn't set a sample rate. The tests never checked the one thing OTLP mode adds for events: that they point at the OpenTelemetry trace.

What the suite checks:

  • The sample's tests, with Sentry's tracing on as in CI, so they still cover Sentry's Spring integration next to the OpenTelemetry starter and the sentry propagator. The log and metric attribute checks the sample had dropped pass, so they stay.
  • New: an error in a request carries the trace of an incoming W3C traceparent, which OpenTelemetry continues and OpenTelemetryOtlpEventProcessor puts on the event.
  • GraphQL errors: since events point at the OpenTelemetry trace, an error can't be tied to Sentry's transaction by trace ID, as the servlet suite does. The GraphQL error tests check the error and the transaction separately, as the sample did.
  • The test client: as in test(spring-boot): [Sample Tests 20] Move the Boot 3 OTel no-agent sample's tests #6312, it's built outside the context, because the OpenTelemetry starter instruments the context's TestRestTemplate.

With no system tests left, the sample comes off the runner and the backend workflow. Only the logback sample remains there, and #6268 removes it. The Spring Boot 4 matrix and integrationTests run the new suite.

For the reviewer: with both enabled, Sentry and OpenTelemetry each trace every request, and errors point at OpenTelemetry's trace. That's what the sample's CI run tested, so the suite keeps it. If the documented OTLP setup means Sentry tracing should stay off, the transaction tests here test a combination users shouldn't have.

After a coverage audit against the sample's tests:

💡 Motivation and Context

sentry-opentelemetry-otlp-spring on Boot 4 now runs in the module, and a test now covers OTLP mode's event linking. The suite runs 23 tests in about 13 seconds.

💚 How did you test it?

  • All 23 tests pass on Spring Boot 4.1.0.
  • They also pass with the catalog set to 4.0.0.
  • Without OpenTelemetryOtlpEventProcessor, only the linking test fails.
  • :sentry-spring-boot-4:check passes, and the sample's JAR still builds.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Cleanup: delete the runner, the Python mock server, the backend workflow and sentry-system-test-support, then update the docs.

#skip-changelog

🤖 Generated with Claude Code

This was referenced Oct 20, 2026
@sentry

sentry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.61.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode force-pushed the no/boot4-otlp-integration-test branch from 64a5df4 to cecf1e0 Compare October 21, 2026 09:19
runningcode and others added 2 commits October 21, 2026 13:22
Adds an integrationTestOtlp suite to sentry-spring-boot-4: the servlet
app with the OpenTelemetry Spring Boot starter, set up by
sentry-opentelemetry-otlp-spring, and OpenTelemetryOtlpEventProcessor.
It ports the sample's tests, which were the servlet suite's without
OkHttp, and keeps the log and metric attribute checks the sample had
dropped.

The sample's transactions came from Sentry's own tracing, which CI
enabled with SENTRY_TRACES_SAMPLE_RATE, so the suite sets the sample
rate the same way. A new test checks what OTLP mode is for: an error in
a request carries the request's OpenTelemetry trace. Events point at
that trace rather than at Sentry's transaction, so the GraphQL errors
are checked next to their transactions instead of by trace ID, as the
sample did.

The sample has no system tests left, so it comes off the system-test
runner and the backend workflow. The Spring Boot 4 matrix and
integrationTests run the new suite.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…oot 4 OTLP suite

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/boot4-otlp-integration-test branch from cecf1e0 to c8fc446 Compare October 21, 2026 11:27

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.

1 participant