sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Dynamic Sampling Support for Java

Open zoesyc opened this issue 3 years ago • 2 comments

Description

In July, we added DS support for Android OkHttp. Here are some PRs created in the process: https://github.com/getsentry/sentry-java/pulls?q=is%3Apr+sort%3Aupdated-desc+baggage+is%3Aclosed.

https://develop.sentry.dev/sdk/performance/dynamic-sampling-context/

We want to extend the support to HTTP clients that we support, including OpenFeign, RestTemplate, apollo, etc.

Additionally, we need server-side support, meaning Spring and SpringBoot. We've built this for Python and Node so far - example:

  • https://github.com/getsentry/sentry-python/pull/1485

Main goals:

  • Add baggage information to outgoing HTTP requests
  • Context required for DS is included in the envelope headers

zoesyc avatar Aug 04 '22 19:08 zoesyc

We're already sending out the baggage header, what's missing is server side baggage support to pass through incoming baggage. For that we have #2085 to track.

Integrations already supporting outgoing baggage header:

  • Feign: https://github.com/getsentry/sentry-java/blob/eba572ac900ca2c58111c6b0db9730a64ac58533/sentry-openfeign/src/main/java/io/sentry/openfeign/SentryFeignClient.java#L57-L64
  • OkHttp: https://github.com/getsentry/sentry-java/blob/eba572ac900ca2c58111c6b0db9730a64ac58533/sentry-android-okhttp/src/main/java/io/sentry/android/okhttp/SentryOkHttpInterceptor.kt#L39-L46
  • Apollo v2: https://github.com/getsentry/sentry-java/blob/eba572ac900ca2c58111c6b0db9730a64ac58533/sentry-apollo/src/main/java/io/sentry/apollo/SentryApolloInterceptor.kt#L41-L46
  • Apollo v3: https://github.com/getsentry/sentry-java/blob/eba572ac900ca2c58111c6b0db9730a64ac58533/sentry-apollo-3/src/main/java/io/sentry/apollo3/SentryApollo3HttpInterceptor.kt#L39-L47
  • Spring WebClient: https://github.com/getsentry/sentry-java/blob/eba572ac900ca2c58111c6b0db9730a64ac58533/sentry-spring/src/main/java/io/sentry/spring/tracing/SentrySpanClientWebRequestFilter.java#L44-L54

Is there something else missing?

adinauer avatar Aug 05 '22 05:08 adinauer

Ah looks like we missed Spring RestTemplate, here's the PR to add it: https://github.com/getsentry/sentry-java/pull/2206

adinauer avatar Aug 05 '22 06:08 adinauer