Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify when to use the OTel starter #3731

Merged
merged 17 commits into from
Jan 11, 2024
Merged
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions content/en/docs/instrumentation/java/automatic/spring-boot.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,40 @@
title: Spring Boot
linkTitle: Spring Boot
weight: 30
description: Spring instrumentation for OpenTelemetry Java
description: Spring Boot instrumentation for OpenTelemetry Java
cSpell:ignore: autoconfigure datasource logback springboot springframework
---

You can use the [OpenTelemetry Java agent](..) with byte code instrumentation to
automatically instrument a [Spring Boot](https://spring.io/projects/spring-boot)
application; or you can also use the OpenTelemetry [Spring Boot starter] to
instrument your application.
The [OpenTelemetry Java agent](..) with byte code instrumentation can cover most
of your needs when instrumenting
[Spring Boot](https://spring.io/projects/spring-boot) applications.

You can't use the OpenTelemetry Java agent with Spring Boot Native image
applications, but you still can instrument your code using OpenTelemetry [Spring
Boot starter].

[Spring Boot starter]:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.build-systems.starters

The OpenTelemetry starter is compatible with Spring Boot 2.0 and 3.0, and Spring
native.
The
[opentelemetry-java-examples/spring-native](https://github.com/open-telemetry/opentelemetry-java-examples/tree/main/spring-native)
repository contains an example of a Spring Boot Native image application
instrumented using the OpenTelemetry Spring Boot starter.

Another situation in which the OpenTelemetry starter can help you is if the
startup overhead of the OpenTelemetry Java agent exceeds your requirements.

If your application already uses another Java monitoring agent, the OpenTelemetry Java agent
might not work. In this case, use the OpenTelemetry starter.
jeanbisutti marked this conversation as resolved.
Show resolved Hide resolved

The rest of this page documents the OpenTelemetry starter that works with Spring
Boot 2.0 and 3.0.

For an example Spring Boot Native image application that uses the OpenTelemetry
Spring Boot starter, see
[opentelemetry-java-examples/spring-native](https://github.com/open-telemetry/opentelemetry-java-examples/tree/main/spring-native).
## OpenTelemetry Spring starter

## Configuration
### Configuration

### Dependency management
#### Dependency management

A Bill of Material
([BOM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms))
Expand Down Expand Up @@ -100,7 +112,7 @@ with the `io.spring.dependency-management` plugin.

{{% /alert %}}

### OpenTelemetry Starter dependency
#### OpenTelemetry Starter dependency

Add the dependency given below to enable the OpenTelemetry starter.

Expand Down Expand Up @@ -134,9 +146,9 @@ dependencies {

{{% /tab %}} {{< /tabpane>}}

## Additional instrumentations
### Additional instrumentations

### JDBC Instrumentation
#### JDBC Instrumentation

You have two ways to enable the JDBC instrumentation with the OpenTelemetry
starter.
Expand Down Expand Up @@ -194,7 +206,7 @@ dependencies {

{{% /tab %}} {{< /tabpane>}}

### Logging Instrumentation
#### Logging Instrumentation

To enable the logging instrumentation for Logback you have to add the
OpenTelemetry appender in your `logback.xml` or `logback-spring.xml` file:
Expand Down Expand Up @@ -243,7 +255,7 @@ and
[Log4j](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/log4j/log4j-appender-2.17/library/README.md)
instrumentation libraries.

### Other Instrumentation
#### Other Instrumentation

You can configure other instrumentations with
[OpenTelemetry instrumentations libraries](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks).
Loading