Skip to content

feat(opentelemetry): Honor OTEL_BSP_SCHEDULE_DELAY in the agent - #6388

Merged
runningcode merged 4 commits into
mainfrom
no/otel-agent-bsp-schedule-delay
Nov 10, 2026
Merged

runningcode merged 4 commits into
mainfrom
no/otel-agent-bsp-schedule-delay

Conversation

@runningcode

@runningcode runningcode commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

We spent a lot of time idling in our tests. The idea behind this PR is to reduce that time.
I asked my agent to take a look at the slowest tests we had and it found that we had some 5 second timeouts in those.

See this scan for BEFORE sorted by slowest tests: https://scans.gradle.com/s/t7basb4sfdkx6/tests/slowest-tests

See this scan for AFTER sorted by slowest tests: https://scans.gradle.com/s/5jvitr5dsslqk/tests/slowest-tests

You can see that the two longest test went from 45s to 5s which shaves a total of 80 seconds off our test time (1:20s).

The only thing to note here is that this affects production code:
The OpenTelemetry agent now honors otel.bsp.schedule.delay (OTEL_BSP_SCHEDULE_DELAY) for the BatchSpanProcessor that sends spans to Sentry. If it isn't set, the OpenTelemetry default of 5 seconds stays.

The Boot 2, Boot 3 and Boot 4 agent suites (integrationTestOtelAgent and integrationTestOtelAgentWithoutAutoInit) set it to 100ms. Their one negative check (unsampled trace sends no transactions) now waits 1 second instead of 6.

💡 Motivation and Context

See the first paragraph for the before and after.

💚 How did you test it?

📝 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.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 3fb316c

@sentry

sentry Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

The agent built Sentry's BatchSpanProcessor with the OpenTelemetry
default, so spans always reached Sentry in 5 second batches, whatever
otel.bsp.schedule.delay said. Read it from the agent's config instead.

The Boot 4 agent suites set it to 100ms. Each of their tests waited for
a 5 second batch, which made them take minutes on CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/otel-agent-bsp-schedule-delay branch from cc1295a to 0b7e042 Compare November 6, 2026 13:30
runningcode and others added 2 commits November 6, 2026 14:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t 3 agent suites

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/otel-agent-bsp-schedule-delay branch from 0b7e042 to 676a5d8 Compare November 6, 2026 13:32
@runningcode
runningcode marked this pull request as ready for review November 6, 2026 13:32
@runningcode
runningcode requested review from a team and adinauer as code owners November 6, 2026 13:32
@runningcode
runningcode requested review from 0xadam-brown and romtsn and removed request for a team November 6, 2026 13:32

@adinauer adinauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In theory this affects existing customers who may already have configured this setting (without taking effect on Sentry) and also have an oddly short or long period configured. I think we can still release this as I think the risk is very minimal.

Comment thread CHANGELOG.md Resolved
Co-authored-by: Alexander Dinauer <adinauer@users.noreply.github.com>
@runningcode
runningcode enabled auto-merge (squash) November 10, 2026 07:06
@runningcode
runningcode merged commit 7c1d596 into main Nov 10, 2026
45 of 46 checks passed
@runningcode
runningcode deleted the no/otel-agent-bsp-schedule-delay branch November 10, 2026 07:22
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.

2 participants