Skip to content

Commit e393ca6

Browse files
jeanbisuttiopentelemetrybotzeitlingertraskcartermp
authored
Clarify Spring Boot starter page (#3985)
Co-authored-by: opentelemetrybot <[email protected]> Co-authored-by: Gregor Zeitlinger <[email protected]> Co-authored-by: Trask Stalnaker <[email protected]> Co-authored-by: Phillip Carter <[email protected]>
1 parent dae3861 commit e393ca6

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

content/en/docs/languages/java/automatic/spring-boot.md

+35-24
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
---
2-
title: Spring Boot Starter
2+
title: Spring Boot
33
linkTitle: Spring Boot
44
weight: 30
55
description: Spring Boot instrumentation for OpenTelemetry Java
66
# prettier-ignore
77
cSpell:ignore: autoconfigurations autoconfigures datasource logback springboot webflux webmvc
88
---
99

10+
## How to instrument Spring Boot with OpenTelemetry
11+
1012
The [OpenTelemetry Java agent](..) with byte code instrumentation can cover most
1113
of your needs when instrumenting
1214
[Spring Boot](https://spring.io/projects/spring-boot) applications.
@@ -26,15 +28,24 @@ following cases:
2628
[Spring Boot starter]:
2729
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using.build-systems.starters
2830

29-
The
31+
The OpenTelemetry Java agent has more automatic instrumentation features than
32+
the OpenTelemetry starter.
33+
34+
You can use
35+
[OpenTelemetry instrumentations libraries](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md#libraries--frameworks)
36+
to complete the automatic instrumentation of the Spring Boot starter.
37+
38+
## OpenTelemetry starter Spring Boot starter
39+
40+
### Compatibility
41+
42+
The OpenTelemetry Spring Boot starter works with Spring Boot 2.0 and 3.0, and
43+
Spring Boot native image applications. The
3044
[opentelemetry-java-examples/spring-native](https://github.com/open-telemetry/opentelemetry-java-examples/tree/main/spring-native)
3145
repository contains an example of a Spring Boot Native image application
3246
instrumented using the OpenTelemetry Spring Boot starter.
3347

34-
The rest of this page documents the OpenTelemetry starter that works with Spring
35-
Boot 2.0 and 3.0.
36-
37-
## Dependency management
48+
### Dependency management
3849

3950
A Bill of Material
4051
([BOM](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms))
@@ -115,7 +126,7 @@ with the `io.spring.dependency-management` plugin.
115126

116127
{{% /alert %}}
117128

118-
### OpenTelemetry Starter dependency
129+
#### OpenTelemetry Starter dependency
119130

120131
Add the dependency given below to enable the OpenTelemetry starter.
121132

@@ -146,15 +157,15 @@ dependencies {
146157

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

149-
### Disable data export
160+
#### Disable data export
150161

151162
{{% config_option name="otel.sdk.disabled" %}}
152163

153164
Set the value to `true` to disable data export, e.g. for testing purposes.
154165

155166
{{% /config_option %}}
156167

157-
## OTLP Exporter
168+
### OTLP Exporter
158169

159170
This package provides autoconfiguration for the
160171
[OTLP](https://github.com/open-telemetry/opentelemetry-java/tree/main/exporters/otlp)
@@ -166,7 +177,7 @@ As of 2.0.0+ the default protocol is `http/protobuf`. For more details on
166177
exporter configuration, see
167178
[OTLP Exporter Configuration](/docs/languages/sdk-configuration/otlp-exporter/).
168179

169-
### Enabling/Disabling Exporters
180+
#### Enabling/Disabling Exporters
170181

171182
All exporters can be enabled or disabled as in the
172183
[SDK autoconfiguration](https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md#exporters).
@@ -181,13 +192,13 @@ the properties below.
181192
| OTLP Logs Exporter | `otel.exporter.otlp.logs.enabled` | true | `OtlpHttpLogRecordExporter`, `OtlpGrpcLogRecordExporter` |
182193
| Logging Exporter | `otel.exporter.logging.enabled` | false | `LoggingSpanExporter` |
183194

184-
## Tracer Properties
195+
### Tracer Properties
185196

186197
| Feature | Property | Default Value |
187198
| ------- | --------------------------------- | ------------- |
188199
| Tracer | `otel.traces.sampler.probability` | 1.0 |
189200

190-
## Resource Properties
201+
### Resource Properties
191202

192203
| Feature | Property | Default Value |
193204
| -------- | ----------------------------------------------------------------------- | ------------- |
@@ -233,7 +244,7 @@ with the OpenTelemetry
233244
4. `spring.application.name` spring property
234245
5. The default value is `unknown_service:java` (lowest precedence)
235246

236-
## Automatic instrumentation
247+
### Automatic instrumentation
237248

238249
Autoconfigures OpenTelemetry instrumentation for
239250
[spring-web](#spring-web-autoconfiguration),
@@ -248,7 +259,7 @@ spring applications.
248259
| spring-webmvc | `otel.instrumentation.spring-web.enabled` | true | `OncePerRequestFilter` |
249260
| spring-webflux | `otel.instrumentation.spring-webflux.enabled` | true | `WebClient` |
250261

251-
### Spring Web Autoconfiguration
262+
#### Spring Web Autoconfiguration
252263

253264
Provides autoconfiguration for the `RestTemplate` trace interceptor defined in
254265
[opentelemetry-spring-web-3.1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-web/spring-web-3.1/library).
@@ -258,7 +269,7 @@ supported for spring web versions 3.1+. To learn more about the OpenTelemetry
258269
`RestTemplate` interceptor, see
259270
[opentelemetry-spring-web-3.1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-web/spring-web-3.1/library).
260271

261-
### Spring Web MVC Autoconfiguration
272+
#### Spring Web MVC Autoconfiguration
262273

263274
This feature autoconfigures instrumentation for Spring WebMVC controllers by
264275
adding a
@@ -269,7 +280,7 @@ request. To learn more about the OpenTelemetry Spring WebMVC instrumentation,
269280
see the
270281
[opentelemetry-spring-webmvc-5.3 instrumentation library](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library).
271282

272-
### Spring WebFlux Autoconfiguration
283+
#### Spring WebFlux Autoconfiguration
273284

274285
Provides autoconfigurations for the OpenTelemetry WebClient ExchangeFilter
275286
defined in
@@ -280,9 +291,9 @@ processor. This feature is supported for spring webflux versions 5.0+. For
280291
details, see
281292
[opentelemetry-spring-webflux-5.3](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/spring-webflux/spring-webflux-5.3/library).
282293

283-
## Additional Instrumentations
294+
### Additional Instrumentations
284295

285-
### JDBC Instrumentation
296+
#### JDBC Instrumentation
286297

287298
You have two ways to enable the JDBC instrumentation with the OpenTelemetry
288299
starter.
@@ -340,7 +351,7 @@ dependencies {
340351

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

343-
### Logging Instrumentation
354+
#### Logging Instrumentation
344355

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

392-
### Instrumentation Annotations
403+
#### Instrumentation Annotations
393404

394405
This feature uses spring-aop to wrap methods annotated with `@WithSpan` in a
395406
span. The arguments to the method can be captured as attributed on the created
@@ -403,7 +414,7 @@ span by annotating the method parameters with `@SpanAttribute`.
403414
| ----------- | ------------------------------------------ | ------------- | ------------------ |
404415
| `@WithSpan` | `otel.instrumentation.annotations.enabled` | true | WithSpan, Aspect |
405416

406-
#### Dependency
417+
##### Dependency
407418

408419
{{< tabpane text=true >}} {{% tab header="Maven (`pom.xml`)" lang=Maven %}}
409420

@@ -433,7 +444,7 @@ dependencies {
433444

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

436-
#### Usage
447+
##### Usage
437448

438449
```java
439450
import org.springframework.stereotype.Component;
@@ -469,12 +480,12 @@ public class TracedClass {
469480
}
470481
```
471482

472-
### OpenTelemetry instrumentations libraries
483+
#### OpenTelemetry instrumentations libraries
473484

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

477-
## Other configurations
488+
## Other solutions
478489

479490
Instead of using the OpenTelemetry Spring starter, you can use the OpenTelemetry
480491
autoconfiguration features with an annotation or the Zipkin starter.

0 commit comments

Comments
 (0)