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

Delete OTLP authenticator concept #6984

Merged
merged 1 commit into from
Jan 6, 2025
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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.opentelemetry.api.metrics.MeterProvider;
import io.opentelemetry.exporter.internal.ExporterBuilderUtil;
import io.opentelemetry.exporter.internal.TlsConfigHelper;
import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.internal.compression.Compressor;
import io.opentelemetry.exporter.internal.marshal.Marshaler;
import io.opentelemetry.sdk.common.export.ProxyOptions;
Expand Down Expand Up @@ -61,7 +60,6 @@ public final class HttpExporterBuilder<T extends Marshaler> {
private TlsConfigHelper tlsConfigHelper = new TlsConfigHelper();
@Nullable private RetryPolicy retryPolicy = RetryPolicy.getDefault();
private Supplier<MeterProvider> meterProviderSupplier = GlobalOpenTelemetry::getMeterProvider;
@Nullable private Authenticator authenticator;

public HttpExporterBuilder(String exporterName, String type, String defaultEndpoint) {
this.exporterName = exporterName;
Expand Down Expand Up @@ -101,11 +99,6 @@ public HttpExporterBuilder<T> setHeadersSupplier(Supplier<Map<String, String>> h
return this;
}

public HttpExporterBuilder<T> setAuthenticator(Authenticator authenticator) {
this.authenticator = authenticator;
return this;
}

public HttpExporterBuilder<T> setTrustManagerFromCerts(byte[] trustedCertificatesPem) {
tlsConfigHelper.setTrustManagerFromCerts(trustedCertificatesPem);
return this;
Expand Down Expand Up @@ -158,7 +151,6 @@ public HttpExporterBuilder<T> copy() {
copy.retryPolicy = retryPolicy.toBuilder().build();
}
copy.meterProviderSupplier = meterProviderSupplier;
copy.authenticator = authenticator;
copy.proxyOptions = proxyOptions;
return copy;
}
Expand Down Expand Up @@ -197,7 +189,6 @@ public HttpExporter<T> build() {
connectTimeoutNanos,
headerSupplier,
proxyOptions,
authenticator,
retryPolicy,
isPlainHttp ? null : tlsConfigHelper.getSslContext(),
isPlainHttp ? null : tlsConfigHelper.getTrustManager());
Expand Down Expand Up @@ -233,7 +224,6 @@ public String toString(boolean includePrefixAndSuffix) {
}
// Note: omit tlsConfigHelper because we can't log the configuration in any readable way
// Note: omit meterProviderSupplier because we can't log the configuration in any readable way
// Note: omit authenticator because we can't log the configuration in any readable way
return joiner.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.exporter.internal.http;

import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.internal.compression.Compressor;
import io.opentelemetry.sdk.common.export.ProxyOptions;
import io.opentelemetry.sdk.common.export.RetryPolicy;
Expand Down Expand Up @@ -36,7 +35,6 @@ HttpSender createSender(
long connectTimeout,
Supplier<Map<String, List<String>>> headerSupplier,
@Nullable ProxyOptions proxyOptions,
@Nullable Authenticator authenticator,
@Nullable RetryPolicy retryPolicy,
@Nullable SSLContext sslContext,
@Nullable X509TrustManager trustManager);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ protected OtlpHttpLogRecordExporterJdkSenderTest() {
super("log", "/v1/logs", ResourceLogs.getDefaultInstance());
}

@Override
protected boolean hasAuthenticatorSupport() {
return false;
}

@Override
protected TelemetryExporterBuilder<LogRecordData> exporterBuilder() {
return new HttpLogRecordExporterBuilderWrapper(OtlpHttpLogRecordExporter.builder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ void stringRepresentation() {
}
}

@Override
protected boolean hasAuthenticatorSupport() {
return false;
}

@Override
protected TelemetryExporterBuilder<MetricData> exporterBuilder() {
return new HttpMetricExporterBuilderWrapper(OtlpHttpMetricExporter.builder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ protected OtlpHttpSpanExporterJdkSenderTest() {
super("span", "/v1/traces", ResourceSpans.getDefaultInstance());
}

@Override
protected boolean hasAuthenticatorSupport() {
return false;
}

@Override
protected TelemetryExporterBuilder<SpanData> exporterBuilder() {
return new HttpSpanExporterBuilderWrapper(OtlpHttpSpanExporter.builder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.jupiter.api.Named.named;
import static org.junit.jupiter.params.provider.Arguments.arguments;

Expand Down Expand Up @@ -402,36 +401,6 @@ void withHeaders() {
}
}

@Test
void withAuthenticator() {
assumeThat(hasAuthenticatorSupport()).isTrue();

TelemetryExporter<T> exporter =
exporterBuilder()
.setEndpoint(server.httpUri() + path)
.setAuthenticator(() -> Collections.singletonMap("key", "value"))
.build();

addHttpError(401);

try {
assertThat(
exporter
.export(Collections.singletonList(generateFakeTelemetry()))
.join(10, TimeUnit.SECONDS)
.isSuccess())
.isTrue();
assertThat(httpRequests)
.element(0)
.satisfies(req -> assertThat(req.headers().get("key")).isNull());
assertThat(httpRequests)
.element(1)
.satisfies(req -> assertThat(req.headers().get("key")).isEqualTo("value"));
} finally {
exporter.shutdown();
}
}

@Test
void tls() throws Exception {
TelemetryExporter<T> exporter =
Expand Down Expand Up @@ -951,11 +920,6 @@ void stringRepresentation() throws IOException, CertificateEncodingException {

protected abstract Marshaler[] toMarshalers(List<T> telemetry);

// TODO: remove once JdkHttpSender supports authenticator
protected boolean hasAuthenticatorSupport() {
return true;
}

private List<U> toProto(List<T> telemetry) {
return Arrays.stream(toMarshalers(telemetry))
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.exporter.otlp.testing.internal;

import io.grpc.ManagedChannel;
import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporterBuilder;
import io.opentelemetry.sdk.common.export.ProxyOptions;
import io.opentelemetry.sdk.common.export.RetryPolicy;
Expand Down Expand Up @@ -75,11 +74,6 @@ public TelemetryExporterBuilder<LogRecordData> setHeaders(
return this;
}

@Override
public TelemetryExporterBuilder<LogRecordData> setAuthenticator(Authenticator authenticator) {
return this;
}

@Override
public TelemetryExporterBuilder<LogRecordData> setTrustedCertificates(byte[] certificates) {
builder.setTrustedCertificates(certificates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.exporter.otlp.testing.internal;

import io.grpc.ManagedChannel;
import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporterBuilder;
import io.opentelemetry.sdk.common.export.ProxyOptions;
import io.opentelemetry.sdk.common.export.RetryPolicy;
Expand Down Expand Up @@ -75,11 +74,6 @@ public TelemetryExporterBuilder<MetricData> setHeaders(
return this;
}

@Override
public TelemetryExporterBuilder<MetricData> setAuthenticator(Authenticator authenticator) {
return this;
}

@Override
public TelemetryExporterBuilder<MetricData> setTrustedCertificates(byte[] certificates) {
builder.setTrustedCertificates(certificates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.opentelemetry.exporter.otlp.testing.internal;

import io.grpc.ManagedChannel;
import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporterBuilder;
import io.opentelemetry.sdk.common.export.ProxyOptions;
import io.opentelemetry.sdk.common.export.RetryPolicy;
Expand Down Expand Up @@ -76,11 +75,6 @@ public TelemetryExporterBuilder<SpanData> setHeaders(
return this;
}

@Override
public TelemetryExporterBuilder<SpanData> setAuthenticator(Authenticator authenticator) {
return this;
}

@Override
public TelemetryExporterBuilder<SpanData> setTrustedCertificates(byte[] certificates) {
builder.setTrustedCertificates(certificates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package io.opentelemetry.exporter.otlp.testing.internal;

import io.opentelemetry.exporter.internal.auth.Authenticator;
import io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporterBuilder;
import io.opentelemetry.sdk.common.export.ProxyOptions;
import io.opentelemetry.sdk.common.export.RetryPolicy;
Expand Down Expand Up @@ -76,12 +75,6 @@ public TelemetryExporterBuilder<LogRecordData> setHeaders(
return this;
}

@Override
public TelemetryExporterBuilder<LogRecordData> setAuthenticator(Authenticator authenticator) {
Authenticator.setAuthenticatorOnDelegate(builder, authenticator);
return this;
}

@Override
public TelemetryExporterBuilder<LogRecordData> setTrustedCertificates(byte[] certificates) {
builder.setTrustedCertificates(certificates);
Expand Down
Loading
Loading