Skip to content

Auto instrumentation doesn't work + JDBC metrics doesn't send #2465

@NDruce

Description

@NDruce

Integration

sentry-spring-boot-starter

Java Version

17

Version

6.0.0

Steps to Reproduce

Followed official tutorials, rereading them ~30 times, searching a lot of Internet for week, and now I decided to create issue.

I have all Maven dependencies, Sentry Exceptions are successfully sending (but settings in application.properties wasn't work so I wasted 1-2 days to make just work anything). But no one Spring Boot MVC requests was traced:
https://docs.sentry.io/platforms/java/guides/spring-boot/performance/instrumentation/automatic-instrumentation/
(all written in instruction I was made and this Bean was told me via System.out.println that it was called). But no Transactions in Sentry. My sentry.properties config:

dsn=https://**********@**************.ingest.sentry.io/**********
traces-sample-rate=1.0
sample-rate=1.0
debug=true
enable-tracing=true
enable-user-interaction-tracing=true
#exception-resolver-order=-2147483647
send-default-pii=true
max-request-body-size=medium
logging.minimum-event-level=info
logging.minimum-breadcrumb-level=debug
max-breadcrumbs=150
#in-app-includes="com.companyname.application"

I made custom instrumentation:
https://hastebin.com/uwulijeput.php

But I think it's kind of crutch and just a desperation, because no other (and more correct) way of tracing requests doesn’t want to work, and therefore I write the entire implementation myself...

With my instrumentation I have no ability to get all detailed stack trace of calling functions where each submethod call is new child span. And I forced to manually declare spans for each submethod in code.

I just want to understand why automatic instrumentation don't working. Because now I have to take time for write each separate span for a lot of method calls.
When with automatic instrumentation, having code like

public void checkout() {
    paymentServiceCall();
    anyOtherMethod();
}

public void paymentServiceCall() {
    runFraudScorer();
    withdrawFunds();
}

, I can leave this code as is and see in Sentry this:

==========================================================

  • checkout span [took X ms]:
    • paymentServiceCall span [took X ms]:
      • runFraudScorer span [took X ms]
      • withdrawFunds span [took X ms]
    • anyOtherMethod span [took X ms]

==========================================================

I want see this look of Trace ^
And to don't to write a lot of times this:

public void checkout() {
    ITransaction transaction = httpServletRequest.getAttribute("sentryTransactionStoredInRequestAttributesToRetrieveItFromDoFilterMethod");

    ISpan paymentServiceCall_Span = transaction.startChild("paymentServiceCall()");
    paymentServiceCall(paymentServiceCall_Span);
    paymentServiceCall_Span.finish();

    ISpan anyOtherMethod_Span = transaction.startChild("anyOtherMethod()");
    anyOtherMethod(anyOtherMethod_Span);
    anyOtherMethod_Span.finish();
}

public void paymentServiceCall(ISpan parentSpan) {
    ISpan runFraudScorer_Span = parentSpan.startChild("runFraudScorer()");
    runFraudScorer(runFraudScorer_Span);
    runFraudScorer_Span.finish();

    ISpan withdrawFunds_Span = parentSpan.startChild("withdrawFunds()");
    withdrawFunds(withdrawFunds_Span);
    withdrawFunds_Span.finish();
}

Expected Result

Described above.

Also JDBC tracing is not working, I don't see anything in Sentry, but configured that by instruction. My application.properties:

pebble.suffix = .peb
pebble.cache=false
spring.application.name=Application
management.metrics.web.server.auto-time-requests=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.hibernate.ddl-auto=create

spring.datasource.url=jdbc:p6spy:h2:mem:testdb
spring.datasource.username=********
spring.datasource.password=********
spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver

endpoints.enabled=true
endpoints.actuator.enabled=true
management.endpoints.enabled-by-default=false
management.endpoint.metrics.enabled=true
management.endpoints.metrics.enabled=true
management.endpoints.web.exposure.include=*

Maven:

<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-jdbc</artifactId>
    <version>6.11.0</version>
</dependency>

Actual Result

No any transaction for any controller request was created. Only with instrumentation coded on my own... As the latest way and the only possible (and single working) way

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions