Skip to content

Commit

Permalink
Remove opentelemetry-exporter-logging because it doesnt work on RDE i…
Browse files Browse the repository at this point in the history
…f you have multiple ServiceLoader Producers of the same interface
  • Loading branch information
royteeuwen committed Oct 23, 2024
1 parent 1776ab5 commit e10c2ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
OTEL_SERVICE_NAME=aem-author
```

For local debugging you can use the logging exporter to print to the console.
For local debugging, add the `opentelemetry-exporter-logging` bundle to your `all` package in start level `15` with a specific profile for
local development, so that you can use the logging exporter to print to the console.

```text
OTEL_TRACES_EXPORTER=logging
Expand All @@ -50,9 +51,11 @@ pid `be.orbinson.aem.opentelemetry.core.services.impl.OpenTelemetryConfigImpl`

Three content packages are provided that can be used.

The `all` package, which you will be using in most case, containing the `minimal` and the `opentelemetry-okhttp-exporter` packages.
The `all` package, which you will be using in most case, containing the `minimal` and the
`opentelemetry-okhttp-exporter` packages.

```xml

<dependency>
<groupId>be.orbinson.aem</groupId>
<artifactId>aemaacs-opentelemetry-instrumentation.all</artifactId>
Expand All @@ -62,6 +65,7 @@ The `all` package, which you will be using in most case, containing the `minimal
The `minimal` package containing the AEMaaCS-specific classes to add instumentation.

```xml

<dependency>
<groupId>be.orbinson.aem</groupId>
<artifactId>aemaacs-opentelemetry-instrumentation.minimal</artifactId>
Expand All @@ -71,6 +75,7 @@ The `minimal` package containing the AEMaaCS-specific classes to add instumentat
The `opentelemetry-okhttp-exporter` package that contains all the OSGi wrapped dependencies.

```xml

<dependency>
<groupId>be.orbinson.aem</groupId>
<artifactId>aemaacs-opentelemetry-instrumentation.opentelemetry-okhttp-exporter</artifactId>
Expand All @@ -79,23 +84,31 @@ The `opentelemetry-okhttp-exporter` package that contains all the OSGi wrapped d

## Instrumented Apache HttpClient

To use an instrumented Apache HttpClient you can use the `io.opentelemetry.instrumentation.apachehttpclient.v4_3.ApacheHttpClientTelemetry`.
To use an instrumented Apache HttpClient you can use the
`io.opentelemetry.instrumentation.apachehttpclient.v4_3.ApacheHttpClientTelemetry`.

```java
// Inject OpenTelemetry service
@OSGiService
private OpenTelemetryFactory openTelemetryFactory;

try(CloseableHttpClient client = ApacheHttpClientTelemetry.create(openTelemetryFactory.get()).newHttpClient()) {
// Create and send a request
HttpGet httpGet = new HttpGet("http://host/endpoint");
try(
CloseableHttpClient client = ApacheHttpClientTelemetry.create(openTelemetryFactory.get()).newHttpClient()){
// Create and send a request
HttpGet httpGet = new HttpGet("http://host/endpoint");

try(
CloseableHttpResponse response = client.execute(httpGet)){
if(response.

try(CloseableHttpResponse response = client.execute(httpGet)) {
if (response.getStatusLine().getStatusCode() == 200) {
// OK
getStatusLine().

getStatusCode() ==200){
// OK
}
}
}catch(
IOException e){
// Handle exception
}
}
} catch (IOException e) {
// Handle exception
}
```
12 changes: 0 additions & 12 deletions opentelemetry-okhttp-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@
/apps/aemaacs-opentelemetry-instrumentation-opentelemetry-okhttp-exporter-packages/application/install/15
</target>
</embedded>
<embedded>
<groupId>be.orbinson.osgi</groupId>
<artifactId>opentelemetry-exporter-logging</artifactId>
<target>
/apps/aemaacs-opentelemetry-instrumentation-opentelemetry-okhttp-exporter-packages/application/install/15
</target>
</embedded>
<embedded>
<groupId>be.orbinson.osgi</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
Expand Down Expand Up @@ -366,11 +359,6 @@
<artifactId>opentelemetry-exporter-common</artifactId>
<version>${opentelemetry.version}.0001</version>
</dependency>
<dependency>
<groupId>be.orbinson.osgi</groupId>
<artifactId>opentelemetry-exporter-logging</artifactId>
<version>${opentelemetry.version}.0001</version>
</dependency>
<dependency>
<groupId>be.orbinson.osgi</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
Expand Down

0 comments on commit e10c2ad

Please sign in to comment.