Title: Custom `TracesSamplerCallback` cannot access Spring request attributes when using OTEL · Issue #4192 · getsentry/sentry-java · GitHub
Open Graph Title: Custom `TracesSamplerCallback` cannot access Spring request attributes when using OTEL · Issue #4192 · getsentry/sentry-java
X Title: Custom `TracesSamplerCallback` cannot access Spring request attributes when using OTEL · Issue #4192 · getsentry/sentry-java
Description: Integration sentry-opentelemetry-agentless-spring Java Version 17 Version 8.1.0 Steps to Reproduce Create a project with spring-boot-starter-web (customer is using v2.7.11, but this is not relevant), sentry-spring-boot-starter and sentry...
Open Graph Description: Integration sentry-opentelemetry-agentless-spring Java Version 17 Version 8.1.0 Steps to Reproduce Create a project with spring-boot-starter-web (customer is using v2.7.11, but this is not relevant...
X Description: Integration sentry-opentelemetry-agentless-spring Java Version 17 Version 8.1.0 Steps to Reproduce Create a project with spring-boot-starter-web (customer is using v2.7.11, but this is not relevant...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/4192
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Custom `TracesSamplerCallback` cannot access Spring request attributes when using OTEL","articleBody":"### Integration\n\nsentry-opentelemetry-agentless-spring\n\n### Java Version\n\n17\n\n### Version\n\n8.1.0\n\n### Steps to Reproduce\n\n1. Create a project with `spring-boot-starter-web` (customer is using v2.7.11, but this is not relevant), `sentry-spring-boot-starter` and `sentry-opentelemetry-agentless-spring`\n2. Follow the [docs](https://docs.sentry.io/platforms/java/guides/spring-boot/configuration/sampling/#setting-a-sampling-function) to set up a custom `TracesSamplerCallback` that returns different sample rates based on the request path\n3. Start application and send HTTP request\n\nReported by pretchu in this [Discord thread](https://discord.com/channels/621778831602221064/1342443294159933450)\n\n### Expected Result\n\nCustom sample rate is returned based on request path, as correctly happens when using the SDK in non-OTEL mode.\n\n### Actual Result\n\n`context.getCustomSamplingContext()` is always `null`, hence the request path cannot be inspected to make a sampling decision.","author":{"url":"https://github.com/lcian","@type":"Person","name":"lcian"},"datePublished":"2025-02-21T16:30:17Z","url":"https://github.com/getsentry/sentry-java/issues/4192"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5fd0c7cb-0375-e862-156f-37ff67609c58 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D002:1F31F7:2306AF:314EC4:6B0468F3 |
| html-safe-nonce | 0e7103e1a510423e191ee0e77fc6a66262e3c3d8170ae210e331a9dc6abac461 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDAyOjFGMzFGNzoyMzA2QUY6MzE0RUM0OjZCMDQ2OEYzIiwidmlzaXRvcl9pZCI6IjU1Nzc3NjU1NTk3MTE1OTA2NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 30a5203596b031ce04b34f64ec623edcd0669addee9a164b636563ce71639e2d |
| hovercard-subject-tag | issue:2869494824 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/4192/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e75566bc45ae673d3847f176fca3e73facd60edec0a6255569c30c78d96ad63/getsentry/sentry-java/issues/4192 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e75566bc45ae673d3847f176fca3e73facd60edec0a6255569c30c78d96ad63/getsentry/sentry-java/issues/4192 |
| og:image:alt | Integration sentry-opentelemetry-agentless-spring Java Version 17 Version 8.1.0 Steps to Reproduce Create a project with spring-boot-starter-web (customer is using v2.7.11, but this is not relevant... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lcian |
| hostname | github.com |
| expected-hostname | github.com |
| None | 83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ca4d07a7cef4e4b75f821dc25e7300d80c1450a9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width