Automatic Instrumentation

Learn what transactions we capture after tracing is enabled.

Capturing transactions requires that you first set up tracing if you haven't already.

Sentry Spring integration, once enabled, captures each incoming Spring MVC HTTP request and turns it into a transaction with SentryTracingFilter. Transaction names follow pattern <HTTP method> <Spring MVC route>, for example for a request to a following controller:

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

class HelloController {

  Person person(@PathVariable Long id) {

Each sampled request executed by this controller method will be turned into a transaction GET /person/{id}.

Sentry Spring integration provides SentrySpanClientHttpRequestInterceptor that creates a span for each outgoing HTTP request executed with a RestTemplate. To use instrumented RestTemplate make sure to set interceptor on the RestTemplate bean:

import io.sentry.IHub;
import io.sentry.spring.tracing.SentrySpanClientHttpRequestInterceptor;
import java.util.Collections;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriTemplateHandler;

class AppConfig {

  RestTemplate restTemplate(IHub hub) {
    RestTemplate restTemplate = new RestTemplate();
    SentrySpanClientHttpRequestInterceptor sentryRestTemplateInterceptor =
        new SentrySpanClientHttpRequestInterceptor(hub);
    return restTemplate;
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").