-
Notifications
You must be signed in to change notification settings - Fork 812
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
201 additions
and
20 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
docs/apidiffs/current_vs_latest/opentelemetry-exporter-http-sender-okhttp.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Comparing source compatibility of against | ||
No changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ters/common/src/main/java/io/opentelemetry/exporter/internal/http/HttpSenderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.exporter.internal.http; | ||
|
||
import io.opentelemetry.exporter.internal.auth.Authenticator; | ||
import io.opentelemetry.exporter.internal.retry.RetryPolicy; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
import javax.annotation.Nullable; | ||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.X509TrustManager; | ||
|
||
/** | ||
* A service provider interface (SPI) for providing {@link HttpSender}s backed by different HTTP | ||
* client libraries. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
public interface HttpSenderProvider { | ||
|
||
/** Returns a {@link HttpSender} configured with the provided parameters. */ | ||
HttpSender createSender( | ||
String endpoint, | ||
boolean compressionEnabled, | ||
String contentType, | ||
long timeoutNanos, | ||
Supplier<Map<String, String>> headerSupplier, | ||
@Nullable Authenticator authenticator, | ||
@Nullable RetryPolicy retryPolicy, | ||
@Nullable SSLContext sslContext, | ||
@Nullable X509TrustManager trustManager); | ||
} |
21 changes: 21 additions & 0 deletions
21
exporters/common/src/test/java/io/opentelemetry/exporter/internal/http/HttpExporterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.exporter.internal.http; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class HttpExporterTest { | ||
|
||
@Test | ||
void build_NoHttpSenderProvider() { | ||
assertThatThrownBy(() -> new HttpExporterBuilder<>("name", "type", "http://localhost").build()) | ||
.isInstanceOf(IllegalStateException.class) | ||
.hasMessage( | ||
"No HttpSenderProvider found on classpath. Please add dependency on opentelemetry-exporter-http-sender-okhttp"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
subprojects { | ||
// Workaround https://github.com/gradle/gradle/issues/847 | ||
group = "io.opentelemetry.exporter.httpsender" | ||
val proj = this | ||
plugins.withId("java") { | ||
configure<BasePluginExtension> { | ||
archivesName.set("opentelemetry-exporter-http-sender-${proj.name}") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugins { | ||
id("otel.java-conventions") | ||
id("otel.publish-conventions") | ||
|
||
id("otel.animalsniffer-conventions") | ||
} | ||
|
||
description = "OpenTelemetry OkHttp HttpSender" | ||
otelJava.moduleName.set("io.opentelemetry.exporter.http.okhttp.internal") | ||
|
||
dependencies { | ||
implementation(project(":exporters:common")) | ||
implementation(project(":sdk:common")) | ||
|
||
implementation("com.squareup.okhttp3:okhttp") | ||
|
||
testImplementation("com.linecorp.armeria:armeria-junit5") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...rc/main/java/io/opentelemetry/exporter/http/okhttp/internal/OkHttpHttpSenderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.exporter.http.okhttp.internal; | ||
|
||
import io.opentelemetry.exporter.internal.auth.Authenticator; | ||
import io.opentelemetry.exporter.internal.http.HttpSender; | ||
import io.opentelemetry.exporter.internal.http.HttpSenderProvider; | ||
import io.opentelemetry.exporter.internal.retry.RetryPolicy; | ||
import java.util.Map; | ||
import java.util.function.Supplier; | ||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.X509TrustManager; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* {@link HttpSender} SPI implementation for {@link OkHttpHttpSender}. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
public class OkHttpHttpSenderProvider implements HttpSenderProvider { | ||
|
||
@Override | ||
public HttpSender createSender( | ||
String endpoint, | ||
boolean compressionEnabled, | ||
String contentType, | ||
long timeoutNanos, | ||
Supplier<Map<String, String>> headerSupplier, | ||
@Nullable Authenticator authenticator, | ||
@Nullable RetryPolicy retryPolicy, | ||
@Nullable SSLContext sslContext, | ||
@Nullable X509TrustManager trustManager) { | ||
return new OkHttpHttpSender( | ||
endpoint, | ||
compressionEnabled, | ||
contentType, | ||
timeoutNanos, | ||
headerSupplier, | ||
authenticator, | ||
retryPolicy, | ||
sslContext, | ||
trustManager); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...der/okhttp/src/main/java/io/opentelemetry/exporter/http/okhttp/internal/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** Utilities for HTTP exporters. */ | ||
@ParametersAreNonnullByDefault | ||
package io.opentelemetry.exporter.http.okhttp.internal; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; |
1 change: 1 addition & 0 deletions
1
...in/resources/META-INF/services/io.opentelemetry.exporter.internal.http.HttpSenderProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.opentelemetry.exporter.http.okhttp.internal.OkHttpHttpSenderProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters