Skip to content
Closed
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,10 @@
Comparing source compatibility of opentelemetry-exporter-logging-otlp-1.55.0-SNAPSHOT.jar against opentelemetry-exporter-logging-otlp-1.54.0.jar
No changes.
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.logging.otlp.OtlpJsonLoggingLogRecordExporter (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.logs.export.LogRecordExporter create(boolean)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.logging.otlp.OtlpJsonLoggingMetricExporter (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.metrics.export.MetricExporter create(io.opentelemetry.sdk.metrics.data.AggregationTemporality, boolean)
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.logging.otlp.OtlpJsonLoggingSpanExporter (not serializable)
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
+++ NEW METHOD: PUBLIC(+) STATIC(+) io.opentelemetry.sdk.trace.export.SpanExporter create(boolean)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.opentelemetry.exporter.logging.otlp.internal.logs.OtlpStdoutLogRecordExporter;
import io.opentelemetry.exporter.logging.otlp.internal.logs.OtlpStdoutLogRecordExporterBuilder;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.export.MemoryMode;
import io.opentelemetry.sdk.logs.data.LogRecordData;
import io.opentelemetry.sdk.logs.export.LogRecordExporter;
import java.util.Collection;
Expand All @@ -33,6 +34,24 @@ public static LogRecordExporter create() {
return new OtlpJsonLoggingLogRecordExporter(delegate);
}

/**
* Returns a new {@link OtlpJsonLoggingLogRecordExporter}.
*
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
* object in an outer JSON "resourceLogs" object. When {@code false}, uses {@link
* MemoryMode#IMMUTABLE_DATA}.
*/
public static LogRecordExporter create(boolean useLowAllocation) {
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
OtlpStdoutLogRecordExporter delegate =
new OtlpStdoutLogRecordExporterBuilder(logger)
.setWrapperJsonObject(useLowAllocation)
.setMemoryMode(memoryMode)
.build();
return new OtlpJsonLoggingLogRecordExporter(delegate);
}

OtlpJsonLoggingLogRecordExporter(OtlpStdoutLogRecordExporter delegate) {
this.delegate = delegate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.opentelemetry.exporter.logging.otlp.internal.metrics.OtlpStdoutMetricExporter;
import io.opentelemetry.exporter.logging.otlp.internal.metrics.OtlpStdoutMetricExporterBuilder;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.export.MemoryMode;
import io.opentelemetry.sdk.metrics.InstrumentType;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
import io.opentelemetry.sdk.metrics.data.MetricData;
Expand Down Expand Up @@ -46,6 +47,27 @@ public static MetricExporter create(AggregationTemporality aggregationTemporalit
return new OtlpJsonLoggingMetricExporter(delegate, aggregationTemporality);
}

/**
* Returns a new {@link OtlpJsonLoggingMetricExporter} with the given {@code
* aggregationTemporality}.
*
* @param aggregationTemporality the aggregation temporality to use
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
* object in an outer JSON "resourceMetrics" object. When {@code false}, uses {@link
* MemoryMode#IMMUTABLE_DATA}.
*/
public static MetricExporter create(
AggregationTemporality aggregationTemporality, boolean useLowAllocation) {
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
OtlpStdoutMetricExporter delegate =
new OtlpStdoutMetricExporterBuilder(logger)
.setWrapperJsonObject(useLowAllocation)
.setMemoryMode(memoryMode)
.build();
return new OtlpJsonLoggingMetricExporter(delegate, aggregationTemporality);
}

OtlpJsonLoggingMetricExporter(
OtlpStdoutMetricExporter delegate, AggregationTemporality aggregationTemporality) {
this.delegate = delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.opentelemetry.exporter.logging.otlp.internal.traces.OtlpStdoutSpanExporter;
import io.opentelemetry.exporter.logging.otlp.internal.traces.OtlpStdoutSpanExporterBuilder;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.common.export.MemoryMode;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import java.util.Collection;
Expand All @@ -31,6 +32,24 @@ public static SpanExporter create() {
return new OtlpJsonLoggingSpanExporter(delegate);
}

/**
* Returns a new {@link OtlpJsonLoggingSpanExporter}.
*
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
* object in an outer JSON "resourceSpans" object. When {@code false}, uses {@link
* MemoryMode#IMMUTABLE_DATA}.
*/
public static SpanExporter create(boolean useLowAllocation) {
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
OtlpStdoutSpanExporter delegate =
new OtlpStdoutSpanExporterBuilder(logger)
.setWrapperJsonObject(useLowAllocation)
.setMemoryMode(memoryMode)
.build();
return new OtlpJsonLoggingSpanExporter(delegate);
}

OtlpJsonLoggingSpanExporter(OtlpStdoutSpanExporter delegate) {
this.delegate = delegate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ public final class OtlpStdoutLogRecordExporter implements LogRecordExporter {

private final Logger logger;
private final JsonWriter jsonWriter;
private final boolean wrapperJsonObject;
private final boolean useLowAllocation;
private final MemoryMode memoryMode;
private final Function<Collection<LogRecordData>, CompletableResultCode> marshaler;

OtlpStdoutLogRecordExporter(
Logger logger, JsonWriter jsonWriter, boolean wrapperJsonObject, MemoryMode memoryMode) {
Logger logger, JsonWriter jsonWriter, boolean useLowAllocation, MemoryMode memoryMode) {
this.logger = logger;
this.jsonWriter = jsonWriter;
this.wrapperJsonObject = wrapperJsonObject;
this.useLowAllocation = useLowAllocation;
this.memoryMode = memoryMode;
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
}

/** Returns a new {@link OtlpStdoutLogRecordExporterBuilder}. */
Expand All @@ -54,8 +54,8 @@ public static OtlpStdoutLogRecordExporterBuilder builder() {
}

private static Function<Collection<LogRecordData>, CompletableResultCode> createMarshaler(
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
if (wrapperJsonObject) {
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
if (useLowAllocation) {
LogReusableDataMarshaler reusableDataMarshaler =
new LogReusableDataMarshaler(
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
Expand Down Expand Up @@ -103,7 +103,7 @@ public CompletableResultCode shutdown() {
public String toString() {
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutLogRecordExporter{", "}");
joiner.add("jsonWriter=" + jsonWriter);
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
joiner.add("useLowAllocation=" + useLowAllocation);
joiner.add("memoryMode=" + memoryMode);
return joiner.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class OtlpStdoutLogRecordExporterBuilder {

private final Logger logger;
private JsonWriter jsonWriter;
private boolean wrapperJsonObject = true;
private boolean useLowAllocation = true;
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;

public OtlpStdoutLogRecordExporterBuilder(Logger logger) {
Expand All @@ -38,11 +38,10 @@ public OtlpStdoutLogRecordExporterBuilder(Logger logger) {
/**
* Sets the exporter to use the specified JSON object wrapper.
*
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceLogs"
* object.
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceLogs" object.
*/
public OtlpStdoutLogRecordExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
this.wrapperJsonObject = wrapperJsonObject;
public OtlpStdoutLogRecordExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
this.useLowAllocation = useLowAllocation;
return this;
}

Expand Down Expand Up @@ -84,10 +83,10 @@ public OtlpStdoutLogRecordExporterBuilder setOutput(Logger logger) {
* @return a new exporter's instance
*/
public OtlpStdoutLogRecordExporter build() {
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
throw new IllegalArgumentException(
"Reusable data mode is not supported without wrapperJsonObject");
"Reusable data mode is not supported without useLowAllocation");
}
return new OtlpStdoutLogRecordExporter(logger, jsonWriter, wrapperJsonObject, memoryMode);
return new OtlpStdoutLogRecordExporter(logger, jsonWriter, useLowAllocation, memoryMode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class OtlpStdoutMetricExporter implements MetricExporter {

private final Logger logger;
private final JsonWriter jsonWriter;
private final boolean wrapperJsonObject;
private final boolean useLowAllocation;
private final MemoryMode memoryMode;
private final Function<Collection<MetricData>, CompletableResultCode> marshaler;
private final AggregationTemporalitySelector aggregationTemporalitySelector;
Expand All @@ -47,17 +47,17 @@ public final class OtlpStdoutMetricExporter implements MetricExporter {
OtlpStdoutMetricExporter(
Logger logger,
JsonWriter jsonWriter,
boolean wrapperJsonObject,
boolean useLowAllocation,
MemoryMode memoryMode,
AggregationTemporalitySelector aggregationTemporalitySelector,
DefaultAggregationSelector defaultAggregationSelector) {
this.logger = logger;
this.jsonWriter = jsonWriter;
this.wrapperJsonObject = wrapperJsonObject;
this.useLowAllocation = useLowAllocation;
this.memoryMode = memoryMode;
this.aggregationTemporalitySelector = aggregationTemporalitySelector;
this.defaultAggregationSelector = defaultAggregationSelector;
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
}

/** Returns a new {@link OtlpStdoutMetricExporterBuilder}. */
Expand All @@ -67,8 +67,8 @@ public static OtlpStdoutMetricExporterBuilder builder() {
}

private static Function<Collection<MetricData>, CompletableResultCode> createMarshaler(
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
if (wrapperJsonObject) {
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
if (useLowAllocation) {
MetricReusableDataMarshaler reusableDataMarshaler =
new MetricReusableDataMarshaler(
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
Expand Down Expand Up @@ -131,7 +131,7 @@ public CompletableResultCode shutdown() {
public String toString() {
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutMetricExporter{", "}");
joiner.add("jsonWriter=" + jsonWriter);
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
joiner.add("useLowAllocation=" + useLowAllocation);
joiner.add("memoryMode=" + memoryMode);
joiner.add(
"aggregationTemporalitySelector="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class OtlpStdoutMetricExporterBuilder {

private final Logger logger;
private JsonWriter jsonWriter;
private boolean wrapperJsonObject = true;
private boolean useLowAllocation = true;
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;

public OtlpStdoutMetricExporterBuilder(Logger logger) {
Expand All @@ -51,11 +51,11 @@ public OtlpStdoutMetricExporterBuilder(Logger logger) {
/**
* Sets the exporter to use the specified JSON object wrapper.
*
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceMetrics"
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceMetrics"
* object.
*/
public OtlpStdoutMetricExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
this.wrapperJsonObject = wrapperJsonObject;
public OtlpStdoutMetricExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
this.useLowAllocation = useLowAllocation;
return this;
}

Expand Down Expand Up @@ -127,14 +127,14 @@ public OtlpStdoutMetricExporterBuilder setDefaultAggregationSelector(
* @return a new exporter's instance
*/
public OtlpStdoutMetricExporter build() {
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
throw new IllegalArgumentException(
"Reusable data mode is not supported without wrapperJsonObject");
"Reusable data mode is not supported without useLowAllocation");
}
return new OtlpStdoutMetricExporter(
logger,
jsonWriter,
wrapperJsonObject,
useLowAllocation,
memoryMode,
aggregationTemporalitySelector,
defaultAggregationSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public final class OtlpStdoutSpanExporter implements SpanExporter {

private final Logger logger;
private final JsonWriter jsonWriter;
private final boolean wrapperJsonObject;
private final boolean useLowAllocation;
private final MemoryMode memoryMode;
private final Function<Collection<SpanData>, CompletableResultCode> marshaler;

OtlpStdoutSpanExporter(
Logger logger, JsonWriter jsonWriter, boolean wrapperJsonObject, MemoryMode memoryMode) {
Logger logger, JsonWriter jsonWriter, boolean useLowAllocation, MemoryMode memoryMode) {
this.logger = logger;
this.jsonWriter = jsonWriter;
this.wrapperJsonObject = wrapperJsonObject;
this.useLowAllocation = useLowAllocation;
this.memoryMode = memoryMode;
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
}

/** Returns a new {@link OtlpStdoutSpanExporterBuilder}. */
Expand All @@ -53,8 +53,8 @@ public static OtlpStdoutSpanExporterBuilder builder() {
}

private static Function<Collection<SpanData>, CompletableResultCode> createMarshaler(
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
if (wrapperJsonObject) {
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
if (useLowAllocation) {
SpanReusableDataMarshaler reusableDataMarshaler =
new SpanReusableDataMarshaler(
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
Expand Down Expand Up @@ -102,7 +102,7 @@ public CompletableResultCode shutdown() {
public String toString() {
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutSpanExporter{", "}");
joiner.add("jsonWriter=" + jsonWriter);
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
joiner.add("useLowAllocation=" + useLowAllocation);
joiner.add("memoryMode=" + memoryMode);
return joiner.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class OtlpStdoutSpanExporterBuilder {

private final Logger logger;
private JsonWriter jsonWriter;
private boolean wrapperJsonObject = true;
private boolean useLowAllocation = true;
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;

public OtlpStdoutSpanExporterBuilder(Logger logger) {
Expand All @@ -38,11 +38,11 @@ public OtlpStdoutSpanExporterBuilder(Logger logger) {
/**
* Sets the exporter to use the specified JSON object wrapper.
*
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceSpans"
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceSpans"
* object.
*/
public OtlpStdoutSpanExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
this.wrapperJsonObject = wrapperJsonObject;
public OtlpStdoutSpanExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
this.useLowAllocation = useLowAllocation;
return this;
}

Expand Down Expand Up @@ -84,10 +84,10 @@ public OtlpStdoutSpanExporterBuilder setOutput(Logger logger) {
* @return a new exporter's instance
*/
public OtlpStdoutSpanExporter build() {
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
throw new IllegalArgumentException(
"Reusable data mode is not supported without wrapperJsonObject");
"Reusable data mode is not supported without useLowAllocation");
}
return new OtlpStdoutSpanExporter(logger, jsonWriter, wrapperJsonObject, memoryMode);
return new OtlpStdoutSpanExporter(logger, jsonWriter, useLowAllocation, memoryMode);
}
}
Loading
Loading