Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
Comparing source compatibility of opentelemetry-exporter-otlp-1.54.0-SNAPSHOT.jar against opentelemetry-exporter-otlp-1.53.0.jar
No changes.
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.logs.OtlpHttpLogRecordExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporterBuilder (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporterBuilder setThrottlingLoggerRate(double, double)
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporterBuilder setThrottlingLoggerTimeUnit(java.util.concurrent.TimeUnit)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.opentelemetry.sdk.common.InternalTelemetryVersion;
import io.opentelemetry.sdk.internal.StandardComponentId;
import io.opentelemetry.sdk.internal.ThrottlingLogger;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.logging.Level;
Expand All @@ -32,7 +33,7 @@ public final class GrpcExporter<T extends Marshaler> {

private static final Logger internalLogger = Logger.getLogger(GrpcExporter.class.getName());

private final ThrottlingLogger logger = new ThrottlingLogger(internalLogger);
private final ThrottlingLogger logger;

// We only log unimplemented once since it's a configuration issue that won't be recovered.
private final AtomicBoolean loggedUnimplemented = new AtomicBoolean();
Expand All @@ -53,6 +54,24 @@ public GrpcExporter(
this.exporterMetrics =
new ExporterInstrumentation(
internalTelemetryVersion, meterProviderSupplier, componentId, endpoint);
this.logger = new ThrottlingLogger(internalLogger);
}

public GrpcExporter(
GrpcSender<T> grpcSender,
InternalTelemetryVersion internalTelemetryVersion,
StandardComponentId componentId,
Supplier<MeterProvider> meterProviderSupplier,
String endpoint,
double rateLimit,
double throttledRateLimit,
TimeUnit rateTimeUnit) {
this.type = componentId.getStandardType().signal().logFriendlyName();
this.grpcSender = grpcSender;
this.exporterMetrics =
new ExporterInstrumentation(
internalTelemetryVersion, meterProviderSupplier, componentId, endpoint);
this.logger = new ThrottlingLogger(internalLogger, rateLimit, throttledRateLimit, rateTimeUnit);
}

public CompletableResultCode export(T exportRequest, int numItems) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public class GrpcExporterBuilder<T extends Marshaler> {
// Use Object type since gRPC may not be on the classpath.
@Nullable private Object grpcChannel;

private double throttlingLoggerRateLimit = 5;
private double throttlingLoggerThrottledRateLimit = 1;
private TimeUnit throttlingLoggerTimeUnit = TimeUnit.MINUTES;

public GrpcExporterBuilder(
StandardComponentId.ExporterType exporterType,
long defaultTimeoutSecs,
Expand Down Expand Up @@ -182,6 +186,17 @@ public GrpcExporterBuilder<T> setExecutorService(ExecutorService executorService
return this;
}

public GrpcExporterBuilder<T> setLogThrottlingRate(double rateLimit, double throttledRateLimit) {
this.throttlingLoggerRateLimit = rateLimit;
this.throttlingLoggerThrottledRateLimit = throttledRateLimit;
return this;
}

public GrpcExporterBuilder<T> setLogThrottlingTimeUnit(TimeUnit rateTimeUnit) {
this.throttlingLoggerTimeUnit = rateTimeUnit;
return this;
}

@SuppressWarnings("BuilderReturnThis")
public GrpcExporterBuilder<T> copy() {
GrpcExporterBuilder<T> copy =
Expand All @@ -205,6 +220,9 @@ public GrpcExporterBuilder<T> copy() {
copy.meterProviderSupplier = meterProviderSupplier;
copy.internalTelemetryVersion = internalTelemetryVersion;
copy.grpcChannel = grpcChannel;
copy.throttlingLoggerRateLimit = throttlingLoggerRateLimit;
copy.throttlingLoggerThrottledRateLimit = throttlingLoggerThrottledRateLimit;
copy.throttlingLoggerTimeUnit = throttlingLoggerTimeUnit;
return copy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.opentelemetry.sdk.internal.StandardComponentId;
import io.opentelemetry.sdk.internal.ThrottlingLogger;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import java.util.logging.Level;
Expand All @@ -32,7 +33,7 @@ public final class HttpExporter<T extends Marshaler> {

private static final Logger internalLogger = Logger.getLogger(HttpExporter.class.getName());

private final ThrottlingLogger logger = new ThrottlingLogger(internalLogger);
private final ThrottlingLogger logger;
private final AtomicBoolean isShutdown = new AtomicBoolean();

private final String type;
Expand All @@ -50,6 +51,24 @@ public HttpExporter(
this.exporterMetrics =
new ExporterInstrumentation(
internalTelemetryVersion, meterProviderSupplier, componentId, endpoint);
this.logger = new ThrottlingLogger(internalLogger);
}

public HttpExporter(
StandardComponentId componentId,
HttpSender httpSender,
Supplier<MeterProvider> meterProviderSupplier,
InternalTelemetryVersion internalTelemetryVersion,
String endpoint,
double rateLimit,
double throttledRateLimit,
TimeUnit rateTimeUnit) {
this.type = componentId.getStandardType().signal().logFriendlyName();
this.httpSender = httpSender;
this.exporterMetrics =
new ExporterInstrumentation(
internalTelemetryVersion, meterProviderSupplier, componentId, endpoint);
this.logger = new ThrottlingLogger(internalLogger, rateLimit, throttledRateLimit, rateTimeUnit);
}

public CompletableResultCode export(T exportRequest, int numItems) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public final class HttpExporterBuilder<T extends Marshaler> {
ComponentLoader.forClassLoader(HttpExporterBuilder.class.getClassLoader());
@Nullable private ExecutorService executorService;

private double throttlingLoggerRateLimit = 5;
private double throttlingLoggerThrottledRateLimit = 1;
private TimeUnit throttlingLoggerTimeUnit = TimeUnit.MINUTES;

public HttpExporterBuilder(
StandardComponentId.ExporterType exporterType, String defaultEndpoint) {
this.exporterType = exporterType;
Expand Down Expand Up @@ -187,6 +191,17 @@ private static StandardComponentId.ExporterType mapToJsonTypeIfPossible(
}
}

public HttpExporterBuilder<T> setLogThrottlingRate(double rateLimit, double throttledRateLimit) {
this.throttlingLoggerRateLimit = rateLimit;
this.throttlingLoggerThrottledRateLimit = throttledRateLimit;
return this;
}

public HttpExporterBuilder<T> setLogThrottlingTimeUnit(TimeUnit rateTimeUnit) {
this.throttlingLoggerTimeUnit = rateTimeUnit;
return this;
}

@SuppressWarnings("BuilderReturnThis")
public HttpExporterBuilder<T> copy() {
HttpExporterBuilder<T> copy = new HttpExporterBuilder<>(exporterType, endpoint);
Expand All @@ -204,6 +219,9 @@ public HttpExporterBuilder<T> copy() {
copy.meterProviderSupplier = meterProviderSupplier;
copy.internalTelemetryVersion = internalTelemetryVersion;
copy.proxyOptions = proxyOptions;
copy.throttlingLoggerRateLimit = throttlingLoggerRateLimit;
copy.throttlingLoggerThrottledRateLimit = throttlingLoggerThrottledRateLimit;
copy.throttlingLoggerTimeUnit = throttlingLoggerTimeUnit;
return copy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,19 @@ public OtlpHttpLogRecordExporterBuilder setExecutorService(ExecutorService execu
return this;
}

/** Set the initial and throttled rate for the ThrottlingLogger. */
public OtlpHttpLogRecordExporterBuilder setThrottlingLoggerRate(
double rateLimit, double throttledRateLimit) {
delegate.setLogThrottlingRate(rateLimit, throttledRateLimit);
return this;
}

/** Set the time unit used for the ThrottlingLogger. */
public OtlpHttpLogRecordExporterBuilder setThrottlingLoggerTimeUnit(TimeUnit rateTimeUnit) {
delegate.setLogThrottlingTimeUnit(rateTimeUnit);
return this;
}

/**
* Constructs a new instance of the exporter based on the builder's values.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,19 @@ OtlpHttpMetricExporterBuilder exportAsJson() {
return this;
}

/** Set the initial and throttled rate for the ThrottlingLogger. */
public OtlpHttpMetricExporterBuilder setThrottlingLoggerRate(
double rateLimit, double throttledRateLimit) {
delegate.setLogThrottlingRate(rateLimit, throttledRateLimit);
return this;
}

/** Set the time unit used for the ThrottlingLogger. */
public OtlpHttpMetricExporterBuilder setThrottlingLoggerTimeUnit(TimeUnit rateTimeUnit) {
delegate.setLogThrottlingTimeUnit(rateTimeUnit);
return this;
}

/**
* Constructs a new instance of the exporter based on the builder's values.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ public OtlpHttpSpanExporterBuilder setExecutorService(ExecutorService executorSe
return this;
}

/** Set the initial and throttled rate for the ThrottlingLogger. */
public OtlpHttpSpanExporterBuilder setThrottlingLoggerRate(
double rateLimit, double throttledRateLimit) {
delegate.setLogThrottlingRate(rateLimit, throttledRateLimit);
return this;
}

/** Set the time unit used for the ThrottlingLogger. */
public OtlpHttpSpanExporterBuilder setThrottlingLoggerTimeUnit(TimeUnit rateTimeUnit) {
delegate.setLogThrottlingTimeUnit(rateTimeUnit);
return this;
}

/**
* Constructs a new instance of the exporter based on the builder's values.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.logging.Logger;
Expand Down Expand Up @@ -62,7 +64,9 @@ public static void configureOtlpExporterBuilder(
Consumer<byte[]> setTrustedCertificates,
BiConsumer<byte[], byte[]> setClientTls,
Consumer<RetryPolicy> setRetryPolicy,
Consumer<MemoryMode> setMemoryMode) {
Consumer<MemoryMode> setMemoryMode,
BiConsumer<Double, Double> setThrottlingLoggerRate,
Consumer<TimeUnit> setThrottlingLoggerTimeUnit) {
setComponentLoader.accept(config.getComponentLoader());

String protocol = getOtlpProtocol(dataType, config);
Expand Down Expand Up @@ -143,6 +147,27 @@ public static void configureOtlpExporterBuilder(
}

ExporterBuilderUtil.configureExporterMemoryMode(config, setMemoryMode);

double logRateStr = config.getDouble("otel.exporter.otlp.lograte", 5);
double logThrottleRateStr = config.getDouble("otel.exporter.otlp.throttledlograte", 1);
setThrottlingLoggerRate.accept(logRateStr, logThrottleRateStr);

String logTimeUnitStr = config.getString("otel.exporter.otlp.logtimeunit", "MINUTES");
TimeUnit logTimeUnit;
switch (logTimeUnitStr.toUpperCase(Locale.ROOT)) {
case "SECONDS":
logTimeUnit = TimeUnit.SECONDS;
break;
case "HOURS":
logTimeUnit = TimeUnit.HOURS;
break;
case "DAYS":
logTimeUnit = TimeUnit.DAYS;
break;
default:
logTimeUnit = TimeUnit.MINUTES;
}
setThrottlingLoggerTimeUnit.accept(logTimeUnit);
}

static void configureOtlpHeaders(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public LogRecordExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
builder.setMeterProvider(meterProviderRef::get);

return builder.build();
Expand All @@ -71,7 +73,9 @@ public LogRecordExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
builder.setMeterProvider(meterProviderRef::get);

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public MetricExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
ExporterBuilderUtil.configureOtlpAggregationTemporality(
config, builder::setAggregationTemporalitySelector);
ExporterBuilderUtil.configureOtlpHistogramDefaultAggregation(
Expand All @@ -67,7 +69,9 @@ public MetricExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
ExporterBuilderUtil.configureOtlpAggregationTemporality(
config, builder::setAggregationTemporalitySelector);
ExporterBuilderUtil.configureOtlpHistogramDefaultAggregation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public SpanExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
builder.setMeterProvider(meterProviderRef::get);

return builder.build();
Expand All @@ -70,7 +72,9 @@ public SpanExporter createExporter(ConfigProperties config) {
builder::setTrustedCertificates,
builder::setClientTls,
builder::setRetryPolicy,
builder::setMemoryMode);
builder::setMemoryMode,
builder::setThrottlingLoggerRate,
builder::setThrottlingLoggerTimeUnit);
builder.setMeterProvider(meterProviderRef::get);

return builder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,19 @@ public OtlpGrpcLogRecordExporterBuilder setExecutorService(ExecutorService execu
return this;
}

/** Set the initial and throttled rate for the ThrottlingLogger. */
public OtlpGrpcLogRecordExporterBuilder setThrottlingLoggerRate(
double rateLimit, double throttledRateLimit) {
delegate.setLogThrottlingRate(rateLimit, throttledRateLimit);
return this;
}

/** Set the time unit used for the ThrottlingLogger. */
public OtlpGrpcLogRecordExporterBuilder setThrottlingLoggerTimeUnit(TimeUnit rateTimeUnit) {
delegate.setLogThrottlingTimeUnit(rateTimeUnit);
return this;
}

/**
* Constructs a new instance of the exporter based on the builder's values.
*
Expand Down
Loading
Loading