I’ve been using Sentry for years in both Python and Java projects for backend error logging and analysis. Super tool!
Now I’m trying to get performance monitoring working in a Grails 4 application. Grails 4.0.x is based on Spring Boot 2.1.8, so I’m using the spring boot integration. As noted above, the error logging with context, tags, breadcrumbs, and user data all works just like it should! I inlcuded
implementation 'io.sentry:sentry-spring-boot-starter:5.5.2'
implementation 'io.sentry:sentry-logback:5.5.2'
in build.gradle
plus this config in `application.yml’
sentry:
dsn: "${SENTRY_DSN}"
in-app-includes: "com.foo.bar"
servername: "localhost"
logging:
enabled: true
minimum-event-level: "info"
minimum-breadcrumb-level: "debug"
use-git-commit-id-as-release: true
send-default-pii: true
environment: "development"
# traces-sample-rate: 1.0
# debug: true
and ,boom, as exected, error logging works immediately.
But when I uncomment
traces-sample-rate: 1.0
I cannot get the automatic instrumention for perf events to work for controllers/methods. I’ve tried it in debug mode too and no events are getting dropped - the codes just isn’t firing to pick them up.
I checked my sentry project and I am not throttled, and I have no inbound filters that would account for this. I tested out the sample app you provided at
and I upgraded the spring-boot-starter-parent to 2.18.RELEASE and upgraded sentry-s-b-starting and sentry-logback to 5.5.2, matching my current setup as best I can.
In that app, I can perf events as well as errors to get sent to Sentry.
I’ve looked looked at Grails 4, and I know that a Grails Controller isn’t really a canonical Spring RestController or Controller, but now I’m stuck. How can or should I drop in some custom code - or annoations - into Grails controllers or services to get things going.
I have tried adding Spring RestController, Component, and Controller annoations bo my controllers without luck. I’ve also tried SentrySpan annoations to work without luck either.
I’m sure the key is that Grails may be based on Spring Boot, but it isn’t Spring Boot. I’m not well-versed enough in Spring MVC or Spring Boot to know how to change the HandlerMapping/RequestMappingInfoHandlerMapping behavior to get the SentryTrackingFilter to catch web requests and instrument them.
I can see from Spring Actuator endpoints that these sentry filters are loaded:
“className”: “io.sentry.spring.SentryUserFilter”
“className”: “io.sentry.spring.SentrySpringFilter”
“className”: “io.sentry.spring.tracing.SentryTracingFilter”
and all are mapped to “/*” urls. Error trapping working, but tracing not so much.
Ironically, visiting the Spring Actuator endpoints does send tracing to Sentry. But no oether endpoints in my Grails app result in tracking.
Many thanks for any tips.