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

Tweak naming of spring autoconfigure and starter modules #6453

Merged
merged 1 commit into from
Aug 16, 2022
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
32 changes: 13 additions & 19 deletions instrumentation/spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,11 @@ To create a sample trace enter `localhost:8080/message` in a browser. This trace

## Auto Instrumentation using Spring Starters

In this tutorial we will create two SpringBoot applications (MainService and TimeService). We will use [opentelemetry-spring-starter](starters/spring-starter) to enable distributed tracing using OpenTelemetry and export spans using the default LoggingSpanExporter. We will also use the [opentelemetry-zipkin-exporter-starter](starters/zipkin-exporter-starter) to export traces to Zipkin.
In this tutorial we will create two SpringBoot applications (MainService and TimeService). We will
use [opentelemetry-spring-boot-starter](starters/spring-boot-starter) to enable distributed tracing using
OpenTelemetry and export spans using the default LoggingSpanExporter. We will also use
the [opentelemetry-zipkin-spring-boot-starter](starters/zipkin-spring-boot-starter) to export traces to
Zipkin.

### OpenTelemetry Spring Starter Dependencies

Expand All @@ -612,14 +616,14 @@ Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.
```xml
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-spring-starter</artifactId>
<artifactId>opentelemetry-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>
```

#### Gradle
```gradle
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter:OPENTELEMETRY_VERSION")
```

### Create two Spring Projects
Expand Down Expand Up @@ -827,21 +831,14 @@ To configure OpenTelemetry tracing with the OTLP, Zipkin, or Jaeger span exporte
<!-- opentelemetry starter with zipkin -->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-zipkin-exporter-starter</artifactId>
<artifactId>opentelemetry-zipkin-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

<!-- opentelemetry starter with jaeger -->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-jaeger-exporter-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

<!-- opentelemetry starter with otlp -->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-otlp-exporter-starter</artifactId>
<artifactId>opentelemetry-jaeger-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>
```
Expand All @@ -850,13 +847,10 @@ To configure OpenTelemetry tracing with the OTLP, Zipkin, or Jaeger span exporte
```gradle

//opentelemetry starter with zipkin configurations
implementation("io.opentelemetry.instrumentation:opentelemetry-zipkin-exporter-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-zipkin-spring-boot-starter:OPENTELEMETRY_VERSION")

//opentelemetry starter with jaeger configurations
implementation("io.opentelemetry.instrumentation:opentelemetry-jaeger-exporter-starter:OPENTELEMETRY_VERSION")

//opentelemetry starter with otlp configurations
implementation("io.opentelemetry.instrumentation:opentelemetry-otlp-exporter-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-jaeger-spring-boot-starter:OPENTELEMETRY_VERSION")
```

#### Exporter Configuration Properties
Expand All @@ -878,15 +872,15 @@ Add the following configurations to overwrite the default exporter values listed
### Sample Trace Zipkin

To generate a trace using the zipkin exporter follow the steps below:
1. Replace `opentelemetry-spring-starter` with `opentelemetry-zipkin-starter` in your pom or gradle build file
1. Replace `opentelemetry-spring-boot-starter` with `opentelemetry-zipkin-spring-boot-starter` in your pom or gradle build file
2. Use the Zipkin [quick starter](https://zipkin.io/pages/quickstart) to download and run the zipkin executable jar
- Ensure the zipkin endpoint matches the default value listed in your application properties
3. Run `MainServiceApplication.java` and `TimeServiceApplication.java`
4. Use your favorite browser to send a request to `http://localhost:8080/message`
5. Navigate to `http://localhost:9411` to see your trace


Shown below is the sample trace generated by `MainService` and `TimeService` using the opentelemetry-zipkin-exporter-starter.
Shown below is the sample trace generated by `MainService` and `TimeService` using the opentelemetry-zipkin-spring-boot-starter.

```json
[
Expand Down
12 changes: 8 additions & 4 deletions instrumentation/spring/spring-boot-autoconfigure/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# OpenTelemetry Spring Auto-Configuration

Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web-3.1), [spring-webmvc](../spring-webmvc-3.1), and [spring-webflux](../spring-webflux-5.0). Leverages Spring Aspect Oriented Programming, dependency injection, and bean post-processing to trace spring applications. To include all features listed below use the [opentelemetry-spring-starter](../starters/spring-starter/README.md).
Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web-3.1/library)
, [spring-webmvc](../spring-webmvc-5.3/library), and [spring-webflux](../spring-webflux-5.0/library)
. Leverages Spring Aspect Oriented Programming, dependency injection, and bean post-processing to
trace spring applications. To include all features listed below use
the [opentelemetry-spring-boot-starter](../starters/spring-boot-starter/README.md).

## Quickstart

### Add these dependencies to your project.

Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.maven.org/search?q=g:io.opentelemetry).
- Minimum version: `0.17.0`
- Minimum version: `1.17.0`


For Maven add to your `pom.xml`:
Expand All @@ -17,7 +21,7 @@ For Maven add to your `pom.xml`:
<!-- opentelemetry -->
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-spring-boot-autoconfigure</artifactId>
<artifactId>opentelemetry-spring-boot</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

Expand All @@ -43,7 +47,7 @@ For Gradle add to your dependencies:

```groovy
//opentelemetry spring auto-configuration
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-autoconfigure:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot:OPENTELEMETRY_VERSION")
//opentelemetry
implementation("io.opentelemetry:opentelemetry-api:OPENTELEMETRY_VERSION")
//opentelemetry exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
id("otel.publish-conventions")
}

// Name the Spring Boot modules in accordance with https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.developing-auto-configuration.custom-starter
base.archivesName.set("opentelemetry-spring-boot")
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename the directory instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could -- I just thought that a directory named just spring-boot would be a tad more confusing than spring-boot-autoconfigure when you look at what the spring dir contains

group = "io.opentelemetry.instrumentation"

val versions: Map<String, String> by project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.

<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-jaeger-exporter-starter</artifactId>
<artifactId>opentelemetry-jaeger-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

Expand All @@ -27,7 +27,7 @@ Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.
#### Gradle

```groovy
implementation("io.opentelemetry.instrumentation:opentelemetry-jaeger-exporter-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-exporter-starter:OPENTELEMETRY_VERSION")
```

### Starter Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ val versions: Map<String, String> by project

dependencies {
api("org.springframework.boot:spring-boot-starter:${versions["org.springframework.boot"]}")
api(project(":instrumentation:spring:starters:spring-starter"))
api(project(":instrumentation:spring:starters:spring-boot-starter"))
api("io.opentelemetry:opentelemetry-exporter-jaeger")
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Add the following dependencies to your `pom.xml` file:

<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-spring-starter</artifactId>
<artifactId>opentelemetry-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

Expand All @@ -31,7 +31,7 @@ Add the following dependencies to your `pom.xml` file:
Add the following dependencies to your gradle.build file:

```groovy
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-spring-boot-starter:OPENTELEMETRY_VERSION")
```

### Starter Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.

<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-zipkin-exporter-starter</artifactId>
<artifactId>opentelemetry-zipkin-spring-boot-starter</artifactId>
<version>OPENTELEMETRY_VERSION</version>
</dependency>

Expand All @@ -29,7 +29,7 @@ Replace `OPENTELEMETRY_VERSION` with the latest stable [release](https://search.
#### Gradle

```groovy
implementation("io.opentelemetry.instrumentation:opentelemetry-zipkin-exporter-starter:OPENTELEMETRY_VERSION")
implementation("io.opentelemetry.instrumentation:opentelemetry-zipkin-spring-boot-starter:OPENTELEMETRY_VERSION")
```

### Starter Guide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ val versions: Map<String, String> by project

dependencies {
api("org.springframework.boot:spring-boot-starter:${versions["org.springframework.boot"]}")
api(project(":instrumentation:spring:starters:spring-starter"))
api(project(":instrumentation:spring:starters:spring-boot-starter"))
api("io.opentelemetry:opentelemetry-exporter-zipkin")
}
6 changes: 3 additions & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ include(":instrumentation:spring:spring-webflux-5.0:javaagent")
include(":instrumentation:spring:spring-webflux-5.0:library")
include(":instrumentation:spring:spring-ws-2.0:javaagent")
include(":instrumentation:spring:spring-boot-autoconfigure")
include(":instrumentation:spring:starters:spring-starter")
include(":instrumentation:spring:starters:jaeger-exporter-starter")
include(":instrumentation:spring:starters:zipkin-exporter-starter")
include(":instrumentation:spring:starters:spring-boot-starter")
include(":instrumentation:spring:starters:jaeger-spring-boot-starter")
include(":instrumentation:spring:starters:zipkin-spring-boot-starter")
include(":instrumentation:spymemcached-2.12:javaagent")
include(":instrumentation:struts-2.3:javaagent")
include(":instrumentation:tapestry-5.4:javaagent")
Expand Down