Commit 0e2c478
Feat/poc continuous profiling (#4556)
* wip
* re-add data category profile_chunk, fix json naming, new converter based on jfr converter bundled with asyncprofiler
* read java thread ids from jfr and use those instead of os thread ids, use existing SentryStackFrame instead of JfrFrame,
* adhere to sentry conventions re format null safety etc, fix compilation
* add profile-session-sample-rate to external options
* add platform as constructor param to ProfileChunk, wip: set java continuous profiler in sentry init
* add doubleToBigDecimal in JfrSample and ProfileChunk, same as we do it in SentrySpan to work around scientific notation of double, use wall clock profiling
* rename JfrProfile to SentryProfile
* move java profiling into its own module, load using SPI
* [WIP] use getProfilingTracesDirPath
* add missing build.gradle.kts for profiler module
* WIP continuous profiling in trace mode
* cleanup unused classes from vendor, cleanup packages
* allow setting profiling-traces-dir-path independently from cache dir using external options
* use profileChunk.platform to decide how to deal with the chunk instead of file extension
* port relevant AndroidContinuousProfilerTest tests to JavaContinuousProfilerTest
* add service loader tests for profiler and profile converter
* remove old jfr test files
* Support ProfileLifecycle.TRACE (#4576)
* delete unused JfrFrame and JfrToSentryProfileconverter
* use passed-in profilingTracesHz parameter instead of hardcoded value
* start profiler before starting the transaction when ProfileLifecycle.TRACE is used to have the profile ID when SentryTracer is created
* use improved way to calculate timestamp of sample
* api dump
* let profile-lifecycle be set from external_options, add tests for SpringBoot autoconfig
* initialize stackTraceFactory only once per chunk
* rename profile data classes, add deserialization and tests
* extract methods in ProfileConverter, fix SentryProfile serialization and make fields private
* use wall=[interval] instead of setting the event to wall and setting the interval separately, this seems to work better and create more samples
* start/stop profiler in OtelSentrySpanProcesser in trace mode for root spans
* add profiler dependency to jakarta-opentelemetry sample, add needed configs
* add dependenies and config to spring-boot-jakarta sample
* remove connection status check
* extract event visitor
* Add enum for ProfileChunk platform
* fallback to default temp directory for profiling on jvm if directory is not configured
* cleanup some minor things
* remove ProfilingInitializer, fix comments
* Format code
* add getter/setter to sample and metadata
* fix compile error
* add comment/todo for deleteOnExit
* Profiling - Deduplication and cleanup (#4681)
* add readme and info about commit of the source repository
* delete jfr file on jvm exit
* further split into smaller methods
* deduplicate frames in order to save bandwidth, add converter tests
* remove Platform Enum, use string constants instead for compatibility with cross platform frameworks
* implement equals and hashcode for SentryStackFrame to make frame deduplication work
* bump api
* improve error handling, fix start stop start flow
* add new testfile
* calculate ticksPerNanosecond in constructor
* adapt Ratelimiter to check for both ProfileChunk and ProfileChunkUi ratelimiting
* update ratelimiter test to check for both profileChunk and profileChunkUi drops
* use string constant instead of string
* Format code
* add non aggregating event collector to send each event individually, deduplicate stacks
* adapt converter tests to new non-aggregated converter
* Format code
* add logging to loadProfileConverter
* Format code
* fix duplication of events
* catch all exception happening when converting from jfr
* add exists and writable info to log message
* add method to safely delete file
* remove setNative call
* fix test
* fix reference to commit we vendored from
* drop event if it cannot be processed to not lose the whole chunk
* make format
* fix test
* Format code
* Profiling - OTEL profiling fix, Stabilization, Logging (#4746)
* add skipProfiling flag to TransactionOptions to be able to skip profiling and handle cases where profiling has been started by otel
* add profilerId to spanContext so that otel span processor can propagate this to the exporter and SentryTracer
* immediately end profiling when stopProfiler is called
* bump api, fix android api 24 code
* catch all exception happening when converting from jfr
* simplify JavaContinuous profiler by catching AsyncProfiler instantiation exceptions in provider
* add exists and writable info to log message
* add method to safely delete file
* remove setNative call
* fix test
* fix reference to commit we vendored from
* drop event if it cannot be processed to not lose the whole chunk
* Format code
* fix test
* Format code
* fix test
* catch exceptions in startProfiler/stopProfiler
* fallback to threadId -1 if it cannot be resolved
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
* change profiler api from Path to String to keep Android Api 21 compatibility
* mark all profiling related classes as internal
* Format code
* mark Sentry profile classes internal
* Format code
* mark SentryThreadMetadata internal
* add changelog entry
* Format code
* re-add asyncprofiler classes, cr changes
* bump api
* detect dangerous/invalid chars in profiling directory name
* ignore vendored profile conversion code in codecov
---------
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>1 parent 604a261 commit 0e2c478
File tree
84 files changed
+6041
-61
lines changed- buildSrc/src/main/java
- sentry-android-core/src/main/java/io/sentry/android/core
- sentry-async-profiler
- api
- src
- main
- java/io/sentry/asyncprofiler
- convert
- profiling
- provider
- vendor/asyncprofiler
- convert
- jfr
- event
- resources/META-INF/services
- test
- java/io/sentry/asyncprofiler
- convert
- profiling
- resources
- sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry
- sentry-samples
- sentry-samples-android/src/main
- sentry-samples-spring-boot-jakarta-opentelemetry
- sentry-samples-spring-boot-jakarta
- src/main/resources
- sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta
- sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot
- sentry
- api
- src
- main/java/io/sentry
- exception
- profiling
- protocol
- profiling
- transport
- test
- java/io/sentry
- profiling
- protocol
- transport
- resources
- META-INF/services
- json
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
84 files changed
+6041
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
0 commit comments