Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatic HTTP Client Instrumentation using sentry-opentelemetry-agentless-spring to track outbound HTTP calls #4902

Unanswered
NINNiT asked this question in Q&A
Discussion options

Hey,

I have a few questions, hope this is the right place to ask them.

We're using spring-boot, sentry, as well as the agentless opentelemetry approach.
Reading through the docs (sentry and otel) it seems that HTTP Instrumentation should basically just work automatically out-of-the-box.
For example, JDBC auto-instrumentation or Spring MVC server traces work without problems.

However this is not the case for HTTP client calls - we have to manually load in the opentelemetry modules...

 <dependency>
 <groupId>io.opentelemetry.instrumentation</groupId>
 <artifactId>opentelemetry-java-http-client</artifactId>
 <version>2.18.0-alpha</version>
 </dependency>

... and then wrap the HttpClient with the Telemetry:

 @Bean
 public HttpClient httpClient() {
 return JavaHttpClientTelemetry.builder(openTelemetry).build().newHttpClient(httpClientBuilder().build());
 }

HTTP Client Traces are then being send to Sentry - however the "Outbound API Requests" view in the Sentry Backend Dashboard still doesn't show any Requests.

  • Is automatic HTTP client instrumentation even possible - or is it always manual?
  • Does the "real" agent support more features / auto-instrumentation than agentless?

Thanks <3


Versions
Spring-Boot: 3.5.7
JDK/JRE: 21 Temurin
Sentry: 8.26.0
Sentry Maven Plugin: 0.9.0


Code Snippets

pom.xml:

 <parent>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-parent</artifactId>
 <version>3.5.7</version>
 </parent>
 <dependencyManagement>
 <dependencies>
 <dependency>
 <groupId>io.sentry</groupId>
 <artifactId>sentry-bom</artifactId>
 <version>8.26.0</version>
 <type>pom</type>
 <scope>import</scope>
 </dependency>
 </dependencies>
 </dependencyManagement>
 
 <dependecies>
 <dependency>
 <groupId>io.sentry</groupId>
 <artifactId>sentry-opentelemetry-agentless-spring</artifactId>
 </dependency>
 </dependencies>
 
 <plugin>
 <groupId>io.sentry</groupId>
 <artifactId>sentry-maven-plugin</artifactId>
 <version>0.9.0</version>
 <extensions>true</extensions>
 <configuration>
 <org>asdf</org>
 <project>myappr</project>
 <url>https://sentry.asdf.eu/</url>
 <!--suppress UnresolvedMavenProperty -->
 <authToken>${env.SENTRY_AUTH_TOKEN}</authToken>
 <debugSentryCli>true</debugSentryCli>
 <skip>false</skip>
 <skipSourceBundle>false</skipSourceBundle>
 <skipAutoInstall>false</skipAutoInstall>
 </configuration>
 <executions>
 <execution>
 <goals>
 <goal>uploadSourceBundle</goal>
 <goal>validateSdkDependencyVersions</goal>
 </goals>
 </execution>
 </executions>
 </plugin>

properties:

sentry.enabled=true
sentry.release=@project.version@
sentry.dsn=https://02b12341c124sfkl92njf121308562acfde@sentry.asdf.eu/37
sentry.send-default-pii=true
sentry.environment=staging
sentry.traces-sample-rate=1.0
sentry.ignored-transactions=.*actuator\/health.*
sentry.debug=false
sentry.logs.enabled=true
sentry.exception-resolver-order=-2147483647
otel.propagators=sentry
otel.traces.exporter=none
otel.metrics.exporter=none
You must be logged in to vote

Replies: 1 comment

Comment options

Hey @NINNiT , it seems, there's no auto config for HttpClient in https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/starters/spring-boot-starter or https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-boot-autoconfigure.

https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-java-instrumentation+path%3A%2F%5Einstrumentation%5C%2Fspring%5C%2Fspring-boot-autoconfigure%5C%2F%2F+HttpClient&type=code

Does the "real" agent support more features / auto-instrumentation than agentless?

Yes, our sentry-opentelemetry-agent does support Java HttpClient without requiring config changes. I just tried this on one of our Samples and was able to see a connected trace for an outgoing request. I was also able to see the request on the "Outbound API Requests" page.

the "Outbound API Requests" view in the Sentry Backend Dashboard still doesn't show any Requests.

Make sure to use the correct instance of HttpClient (the one defined as bean) when making the request.
You are also using version 2.18.0-alpha instead of 2.17.0-alpha which causes a NoSuchMethodError 'boolean io.opentelemetry.instrumentation.api.internal.SemconvStability.isEmitOldCodeSemconv()'. Once downgraded, the exception goes away. Both showed up on the "Outbound API Requests" page for me.

Please make sure to use the correct OTel version as otherwise it causes a mix of OpenTelemetry versions, leading to unexpected behaviour, potentially including crashes.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /