Skip to content

Conversation

lbloder
Copy link
Collaborator

@lbloder lbloder commented Jul 15, 2025

📜 Description

💡 Motivation and Context

Initial implementation of #2635

💚 How did you test it?

📝 Checklist

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

🔮 Next steps


Note

Adds async-profiler–backed JVM continuous profiling with ServiceLoader SPI, new SentryProfile payload in ProfileChunk, TRACE lifecycle start/stop, and related options/rate-limiting updates.

  • Profiling (JVM):
    • Introduces sentry-async-profiler module (async-profiler 3.0) with providers for JavaContinuousProfiler and JFR→Sentry conversion.
    • New ServiceLoader SPIs: JavaContinuousProfilerProvider, JavaProfileConverterProvider and loader ProfilingServiceLoader.
  • Profile payload/serialization:
    • Extend ProfileChunk with platform, profile (structured SentryProfile) and precise timestamps; keep Base64 path for Android; add PLATFORM_ANDROID/PLATFORM_JAVA.
    • New protocol types: profiling.SentryProfile, SentrySample, SentryThreadMetadata; SentryStackFrame equality/hash.
  • SDK integration:
    • Auto-init JVM profiler and fallback traces dir; start/stop on root spans for TRACE in Scopes and OTel span processor; propagate profiler id to spans/transactions.
    • Envelope item builds profile via converter for JVM, Base64 for Android.
  • Options & external config:
    • Add profile-session-sample-rate, profiling-traces-dir-path, profile-lifecycle; expose in SentryOptions and properties parsing.
  • Rate limiting:
    • Support profile_chunk category in addition to profile_chunk_ui.
  • Android:
    • Mark Android profile chunks with PLATFORM_ANDROID.
  • Build/Samples/CI:
    • Register new module in settings; ignore vendored async-profiler in Codecov; sample apps wired with profiler deps and env props; minor DSN host tweak.
  • Tests:
    • Extensive unit tests for profiling SPI, serialization, service loading, options, rate limiting, and async-profiler module.

Written by Cursor Bugbot for commit 66413a0. This will update automatically on new commits. Configure here.

lbloder added 21 commits April 25, 2025 12:14
…sed on jfr converter bundled with asyncprofiler
… use existing SentryStackFrame instead of JfrFrame,
…t in SentrySpan to work around scientific notation of double, use wall clock profiling
# Conflicts:
#	sentry/build.gradle.kts
#	sentry/src/test/java/io/sentry/ExternalOptionsTest.kt
#	sentry/src/test/java/io/sentry/JsonSerializerTest.kt
#	sentry/src/test/java/io/sentry/SentryClientTest.kt
#	sentry/src/test/java/io/sentry/SentryOptionsTest.kt
Copy link
Contributor

github-actions bot commented Jul 15, 2025

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

Generated by 🚫 dangerJS against 66413a0

Copy link
Contributor

github-actions bot commented Jul 15, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 388.26 ms 488.10 ms 99.84 ms
Size 1.58 MiB 2.10 MiB 535.09 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b750b96 408.98 ms 480.32 ms 71.34 ms
ee747ae 357.79 ms 421.84 ms 64.05 ms
3998a95 415.94 ms 478.54 ms 62.60 ms
85d7417 347.21 ms 394.35 ms 47.15 ms
806307f 357.85 ms 424.64 ms 66.79 ms
d217708 409.83 ms 474.72 ms 64.89 ms
c8125f3 397.65 ms 485.14 ms 87.49 ms
ee747ae 396.82 ms 441.67 ms 44.86 ms
3699cd5 423.60 ms 495.52 ms 71.92 ms
f634d01 359.58 ms 433.88 ms 74.30 ms

App size

Revision Plain With Sentry Diff
b750b96 1.58 MiB 2.10 MiB 533.19 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
3998a95 1.58 MiB 2.10 MiB 532.96 KiB
85d7417 1.58 MiB 2.10 MiB 533.44 KiB
806307f 1.58 MiB 2.10 MiB 533.42 KiB
d217708 1.58 MiB 2.10 MiB 532.97 KiB
c8125f3 1.58 MiB 2.10 MiB 532.32 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
3699cd5 1.58 MiB 2.10 MiB 533.45 KiB
f634d01 1.58 MiB 2.10 MiB 533.40 KiB

Previous results on branch: feat/poc-continuous-profiling

Startup times

Revision Plain With Sentry Diff
0939549 368.64 ms 439.17 ms 70.52 ms
212c151 372.36 ms 456.94 ms 84.58 ms
abfc274 384.37 ms 412.52 ms 28.15 ms
f172894 363.82 ms 424.87 ms 61.06 ms
9e8e7bb 381.60 ms 425.33 ms 43.72 ms

App size

Revision Plain With Sentry Diff
0939549 1.58 MiB 2.10 MiB 535.24 KiB
212c151 1.58 MiB 2.10 MiB 533.69 KiB
abfc274 1.58 MiB 2.10 MiB 535.19 KiB
f172894 1.58 MiB 2.10 MiB 535.19 KiB
9e8e7bb 1.58 MiB 2.10 MiB 533.10 KiB

@adinauer
Copy link
Member

@sentry review

Copy link
Contributor

github-actions bot commented Sep 29, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

@adinauer
Copy link
Member

@cursor review

@adinauer
Copy link
Member

@sentry review

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

github-actions bot commented Sep 30, 2025

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

&& scopes.getOptions().isContinuousProfilingEnabled()
&& scopes.getOptions().getProfileLifecycle() == ProfileLifecycle.TRACE) {
scopes.getOptions().getContinuousProfiler().stopProfiler(ProfileLifecycle.TRACE);
}
Copy link

Choose a reason for hiding this comment

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

Bug: Profiler Stops Prematurely for Unsampled Spans

The OtelSentrySpanProcessor.onEnd method stops the continuous profiler for root spans without checking if the span was sampled or if its profiler ID matches the currently active global profiler. This can lead to the profiler stopping prematurely, affecting other active traces.

Fix in Cursor Fix in Web

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.

5 participants