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

Small spring fixes #4677

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 additions & 0 deletions content/en/docs/languages/java/instrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,23 @@ import io.opentelemetry.api.GlobalOpenTelemetry;
Tracer tracer = GlobalOpenTelemetry.getTracer("application");
```

If you are using Spring Boot, you can add the following bean to your
`@SpringBootApplication` class - to acquire a `Tracer` as in the
[Spring Boot starter](#acquiring-a-tracer-in-spring-boot-starter) section below:
theletterf marked this conversation as resolved.
Show resolved Hide resolved

```java
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.GlobalOpenTelemetry;

@Configuration
public class OpenTelemetryConfig {
@Bean
public OpenTelemetry openTelemetry() {
return GlobalOpenTelemetry.get();
}
}
```

### Acquiring a tracer in Spring Boot starter

If you are using the [Spring Boot starter], you can acquire a `Tracer` from the
Expand Down Expand Up @@ -1257,6 +1274,23 @@ import io.opentelemetry.api.GlobalOpenTelemetry;
Meter meter = GlobalOpenTelemetry.getMeter("application");
```

If you are using Spring Boot, you can add the following bean to your
`@SpringBootApplication` class - to acquire a `Meter` as in the
[Spring Boot starter](#acquiring-a-meter-in-spring-boot-starter) section below:
theletterf marked this conversation as resolved.
Show resolved Hide resolved

```java
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.api.GlobalOpenTelemetry;

@Configuration
public class OpenTelemetryConfig {
@Bean
public OpenTelemetry openTelemetry() {
return GlobalOpenTelemetry.get();
}
}
```

### Acquiring a meter in Spring Boot starter

If you are using the [Spring Boot starter], you can acquire a `Meter` from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ application. For the pros and cons, see [Java zero-code instrumentation](..).

### Compatibility

The OpenTelemetry Spring Boot starter works with Spring Boot 2.6+ and 3.0+, and
The OpenTelemetry Spring Boot starter works with Spring Boot 2.6+ and 3.1+, and
theletterf marked this conversation as resolved.
Show resolved Hide resolved
Spring Boot native image applications. 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
Expand Down