Skip to content

Commit e1fc21e

Browse files
committed
polish: Rename wrapperJsonObject parameter to useLowAllocation
1 parent 2748933 commit e1fc21e

16 files changed

+107
-113
lines changed

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingLogRecordExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ public static LogRecordExporter create() {
3737
/**
3838
* Returns a new {@link OtlpJsonLoggingLogRecordExporter}.
3939
*
40-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceLogs"
41-
* object. When {@code true}, uses low allocation OTLP marshalers with {@link
42-
* MemoryMode#REUSABLE_DATA}. When {@code false}, uses {@link MemoryMode#IMMUTABLE_DATA}.
40+
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
41+
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
42+
* object in an outer JSON "resourceLogs" object. When {@code false}, uses {@link
43+
* MemoryMode#IMMUTABLE_DATA}.
4344
*/
44-
public static LogRecordExporter create(boolean wrapperJsonObject) {
45-
MemoryMode memoryMode =
46-
wrapperJsonObject ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
45+
public static LogRecordExporter create(boolean useLowAllocation) {
46+
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
4747
OtlpStdoutLogRecordExporter delegate =
4848
new OtlpStdoutLogRecordExporterBuilder(logger)
49-
.setWrapperJsonObject(wrapperJsonObject)
49+
.setWrapperJsonObject(useLowAllocation)
5050
.setMemoryMode(memoryMode)
5151
.build();
5252
return new OtlpJsonLoggingLogRecordExporter(delegate);

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingMetricExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ public static MetricExporter create(AggregationTemporality aggregationTemporalit
5252
* aggregationTemporality}.
5353
*
5454
* @param aggregationTemporality the aggregation temporality to use
55-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceMetrics"
56-
* object. When {@code true}, uses low allocation OTLP marshalers with {@link
57-
* MemoryMode#REUSABLE_DATA}. When {@code false}, uses {@link MemoryMode#IMMUTABLE_DATA}.
55+
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
56+
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
57+
* object in an outer JSON "resourceMetrics" object. When {@code false}, uses {@link
58+
* MemoryMode#IMMUTABLE_DATA}.
5859
*/
5960
public static MetricExporter create(
60-
AggregationTemporality aggregationTemporality, boolean wrapperJsonObject) {
61-
MemoryMode memoryMode =
62-
wrapperJsonObject ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
61+
AggregationTemporality aggregationTemporality, boolean useLowAllocation) {
62+
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
6363
OtlpStdoutMetricExporter delegate =
6464
new OtlpStdoutMetricExporterBuilder(logger)
65-
.setWrapperJsonObject(wrapperJsonObject)
65+
.setWrapperJsonObject(useLowAllocation)
6666
.setMemoryMode(memoryMode)
6767
.build();
6868
return new OtlpJsonLoggingMetricExporter(delegate, aggregationTemporality);

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/OtlpJsonLoggingSpanExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ public static SpanExporter create() {
3535
/**
3636
* Returns a new {@link OtlpJsonLoggingSpanExporter}.
3737
*
38-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceSpans"
39-
* object. When {@code true}, uses low allocation OTLP marshalers with {@link
40-
* MemoryMode#REUSABLE_DATA}. When {@code false}, uses {@link MemoryMode#IMMUTABLE_DATA}.
38+
* @param useLowAllocation whether to use low allocation OTLP marshalers with {@link
39+
* MemoryMode#REUSABLE_DATA}. When {@code true}, uses low allocation mode and wraps the JSON
40+
* object in an outer JSON "resourceSpans" object. When {@code false}, uses {@link
41+
* MemoryMode#IMMUTABLE_DATA}.
4142
*/
42-
public static SpanExporter create(boolean wrapperJsonObject) {
43-
MemoryMode memoryMode =
44-
wrapperJsonObject ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
43+
public static SpanExporter create(boolean useLowAllocation) {
44+
MemoryMode memoryMode = useLowAllocation ? MemoryMode.REUSABLE_DATA : MemoryMode.IMMUTABLE_DATA;
4545
OtlpStdoutSpanExporter delegate =
4646
new OtlpStdoutSpanExporterBuilder(logger)
47-
.setWrapperJsonObject(wrapperJsonObject)
47+
.setWrapperJsonObject(useLowAllocation)
4848
.setMemoryMode(memoryMode)
4949
.build();
5050
return new OtlpJsonLoggingSpanExporter(delegate);

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/logs/OtlpStdoutLogRecordExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ public final class OtlpStdoutLogRecordExporter implements LogRecordExporter {
3434

3535
private final Logger logger;
3636
private final JsonWriter jsonWriter;
37-
private final boolean wrapperJsonObject;
37+
private final boolean useLowAllocation;
3838
private final MemoryMode memoryMode;
3939
private final Function<Collection<LogRecordData>, CompletableResultCode> marshaler;
4040

4141
OtlpStdoutLogRecordExporter(
42-
Logger logger, JsonWriter jsonWriter, boolean wrapperJsonObject, MemoryMode memoryMode) {
42+
Logger logger, JsonWriter jsonWriter, boolean useLowAllocation, MemoryMode memoryMode) {
4343
this.logger = logger;
4444
this.jsonWriter = jsonWriter;
45-
this.wrapperJsonObject = wrapperJsonObject;
45+
this.useLowAllocation = useLowAllocation;
4646
this.memoryMode = memoryMode;
47-
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
47+
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
4848
}
4949

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

5656
private static Function<Collection<LogRecordData>, CompletableResultCode> createMarshaler(
57-
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
58-
if (wrapperJsonObject) {
57+
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
58+
if (useLowAllocation) {
5959
LogReusableDataMarshaler reusableDataMarshaler =
6060
new LogReusableDataMarshaler(
6161
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
@@ -103,7 +103,7 @@ public CompletableResultCode shutdown() {
103103
public String toString() {
104104
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutLogRecordExporter{", "}");
105105
joiner.add("jsonWriter=" + jsonWriter);
106-
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
106+
joiner.add("useLowAllocation=" + useLowAllocation);
107107
joiner.add("memoryMode=" + memoryMode);
108108
return joiner.toString();
109109
}

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/logs/OtlpStdoutLogRecordExporterBuilder.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class OtlpStdoutLogRecordExporterBuilder {
2727

2828
private final Logger logger;
2929
private JsonWriter jsonWriter;
30-
private boolean wrapperJsonObject = true;
30+
private boolean useLowAllocation = true;
3131
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;
3232

3333
public OtlpStdoutLogRecordExporterBuilder(Logger logger) {
@@ -38,11 +38,10 @@ public OtlpStdoutLogRecordExporterBuilder(Logger logger) {
3838
/**
3939
* Sets the exporter to use the specified JSON object wrapper.
4040
*
41-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceLogs"
42-
* object.
41+
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceLogs" object.
4342
*/
44-
public OtlpStdoutLogRecordExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
45-
this.wrapperJsonObject = wrapperJsonObject;
43+
public OtlpStdoutLogRecordExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
44+
this.useLowAllocation = useLowAllocation;
4645
return this;
4746
}
4847

@@ -84,10 +83,10 @@ public OtlpStdoutLogRecordExporterBuilder setOutput(Logger logger) {
8483
* @return a new exporter's instance
8584
*/
8685
public OtlpStdoutLogRecordExporter build() {
87-
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
86+
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
8887
throw new IllegalArgumentException(
89-
"Reusable data mode is not supported without wrapperJsonObject");
88+
"Reusable data mode is not supported without useLowAllocation");
9089
}
91-
return new OtlpStdoutLogRecordExporter(logger, jsonWriter, wrapperJsonObject, memoryMode);
90+
return new OtlpStdoutLogRecordExporter(logger, jsonWriter, useLowAllocation, memoryMode);
9291
}
9392
}

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/metrics/OtlpStdoutMetricExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public final class OtlpStdoutMetricExporter implements MetricExporter {
3838

3939
private final Logger logger;
4040
private final JsonWriter jsonWriter;
41-
private final boolean wrapperJsonObject;
41+
private final boolean useLowAllocation;
4242
private final MemoryMode memoryMode;
4343
private final Function<Collection<MetricData>, CompletableResultCode> marshaler;
4444
private final AggregationTemporalitySelector aggregationTemporalitySelector;
@@ -47,17 +47,17 @@ public final class OtlpStdoutMetricExporter implements MetricExporter {
4747
OtlpStdoutMetricExporter(
4848
Logger logger,
4949
JsonWriter jsonWriter,
50-
boolean wrapperJsonObject,
50+
boolean useLowAllocation,
5151
MemoryMode memoryMode,
5252
AggregationTemporalitySelector aggregationTemporalitySelector,
5353
DefaultAggregationSelector defaultAggregationSelector) {
5454
this.logger = logger;
5555
this.jsonWriter = jsonWriter;
56-
this.wrapperJsonObject = wrapperJsonObject;
56+
this.useLowAllocation = useLowAllocation;
5757
this.memoryMode = memoryMode;
5858
this.aggregationTemporalitySelector = aggregationTemporalitySelector;
5959
this.defaultAggregationSelector = defaultAggregationSelector;
60-
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
60+
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
6161
}
6262

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

6969
private static Function<Collection<MetricData>, CompletableResultCode> createMarshaler(
70-
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
71-
if (wrapperJsonObject) {
70+
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
71+
if (useLowAllocation) {
7272
MetricReusableDataMarshaler reusableDataMarshaler =
7373
new MetricReusableDataMarshaler(
7474
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
@@ -131,7 +131,7 @@ public CompletableResultCode shutdown() {
131131
public String toString() {
132132
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutMetricExporter{", "}");
133133
joiner.add("jsonWriter=" + jsonWriter);
134-
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
134+
joiner.add("useLowAllocation=" + useLowAllocation);
135135
joiner.add("memoryMode=" + memoryMode);
136136
joiner.add(
137137
"aggregationTemporalitySelector="

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/metrics/OtlpStdoutMetricExporterBuilder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public final class OtlpStdoutMetricExporterBuilder {
4040

4141
private final Logger logger;
4242
private JsonWriter jsonWriter;
43-
private boolean wrapperJsonObject = true;
43+
private boolean useLowAllocation = true;
4444
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;
4545

4646
public OtlpStdoutMetricExporterBuilder(Logger logger) {
@@ -51,11 +51,11 @@ public OtlpStdoutMetricExporterBuilder(Logger logger) {
5151
/**
5252
* Sets the exporter to use the specified JSON object wrapper.
5353
*
54-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceMetrics"
54+
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceMetrics"
5555
* object.
5656
*/
57-
public OtlpStdoutMetricExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
58-
this.wrapperJsonObject = wrapperJsonObject;
57+
public OtlpStdoutMetricExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
58+
this.useLowAllocation = useLowAllocation;
5959
return this;
6060
}
6161

@@ -127,14 +127,14 @@ public OtlpStdoutMetricExporterBuilder setDefaultAggregationSelector(
127127
* @return a new exporter's instance
128128
*/
129129
public OtlpStdoutMetricExporter build() {
130-
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
130+
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
131131
throw new IllegalArgumentException(
132-
"Reusable data mode is not supported without wrapperJsonObject");
132+
"Reusable data mode is not supported without useLowAllocation");
133133
}
134134
return new OtlpStdoutMetricExporter(
135135
logger,
136136
jsonWriter,
137-
wrapperJsonObject,
137+
useLowAllocation,
138138
memoryMode,
139139
aggregationTemporalitySelector,
140140
defaultAggregationSelector);

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/traces/OtlpStdoutSpanExporter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ public final class OtlpStdoutSpanExporter implements SpanExporter {
3333

3434
private final Logger logger;
3535
private final JsonWriter jsonWriter;
36-
private final boolean wrapperJsonObject;
36+
private final boolean useLowAllocation;
3737
private final MemoryMode memoryMode;
3838
private final Function<Collection<SpanData>, CompletableResultCode> marshaler;
3939

4040
OtlpStdoutSpanExporter(
41-
Logger logger, JsonWriter jsonWriter, boolean wrapperJsonObject, MemoryMode memoryMode) {
41+
Logger logger, JsonWriter jsonWriter, boolean useLowAllocation, MemoryMode memoryMode) {
4242
this.logger = logger;
4343
this.jsonWriter = jsonWriter;
44-
this.wrapperJsonObject = wrapperJsonObject;
44+
this.useLowAllocation = useLowAllocation;
4545
this.memoryMode = memoryMode;
46-
marshaler = createMarshaler(jsonWriter, memoryMode, wrapperJsonObject);
46+
marshaler = createMarshaler(jsonWriter, memoryMode, useLowAllocation);
4747
}
4848

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

5555
private static Function<Collection<SpanData>, CompletableResultCode> createMarshaler(
56-
JsonWriter jsonWriter, MemoryMode memoryMode, boolean wrapperJsonObject) {
57-
if (wrapperJsonObject) {
56+
JsonWriter jsonWriter, MemoryMode memoryMode, boolean useLowAllocation) {
57+
if (useLowAllocation) {
5858
SpanReusableDataMarshaler reusableDataMarshaler =
5959
new SpanReusableDataMarshaler(
6060
memoryMode, (marshaler, numItems) -> jsonWriter.write(marshaler));
@@ -102,7 +102,7 @@ public CompletableResultCode shutdown() {
102102
public String toString() {
103103
StringJoiner joiner = new StringJoiner(", ", "OtlpStdoutSpanExporter{", "}");
104104
joiner.add("jsonWriter=" + jsonWriter);
105-
joiner.add("wrapperJsonObject=" + wrapperJsonObject);
105+
joiner.add("useLowAllocation=" + useLowAllocation);
106106
joiner.add("memoryMode=" + memoryMode);
107107
return joiner.toString();
108108
}

exporters/logging-otlp/src/main/java/io/opentelemetry/exporter/logging/otlp/internal/traces/OtlpStdoutSpanExporterBuilder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class OtlpStdoutSpanExporterBuilder {
2727

2828
private final Logger logger;
2929
private JsonWriter jsonWriter;
30-
private boolean wrapperJsonObject = true;
30+
private boolean useLowAllocation = true;
3131
private MemoryMode memoryMode = MemoryMode.IMMUTABLE_DATA;
3232

3333
public OtlpStdoutSpanExporterBuilder(Logger logger) {
@@ -38,11 +38,11 @@ public OtlpStdoutSpanExporterBuilder(Logger logger) {
3838
/**
3939
* Sets the exporter to use the specified JSON object wrapper.
4040
*
41-
* @param wrapperJsonObject whether to wrap the JSON object in an outer JSON "resourceSpans"
41+
* @param useLowAllocation whether to wrap the JSON object in an outer JSON "resourceSpans"
4242
* object.
4343
*/
44-
public OtlpStdoutSpanExporterBuilder setWrapperJsonObject(boolean wrapperJsonObject) {
45-
this.wrapperJsonObject = wrapperJsonObject;
44+
public OtlpStdoutSpanExporterBuilder setWrapperJsonObject(boolean useLowAllocation) {
45+
this.useLowAllocation = useLowAllocation;
4646
return this;
4747
}
4848

@@ -84,10 +84,10 @@ public OtlpStdoutSpanExporterBuilder setOutput(Logger logger) {
8484
* @return a new exporter's instance
8585
*/
8686
public OtlpStdoutSpanExporter build() {
87-
if (memoryMode == MemoryMode.REUSABLE_DATA && !wrapperJsonObject) {
87+
if (memoryMode == MemoryMode.REUSABLE_DATA && !useLowAllocation) {
8888
throw new IllegalArgumentException(
89-
"Reusable data mode is not supported without wrapperJsonObject");
89+
"Reusable data mode is not supported without useLowAllocation");
9090
}
91-
return new OtlpStdoutSpanExporter(logger, jsonWriter, wrapperJsonObject, memoryMode);
91+
return new OtlpStdoutSpanExporter(logger, jsonWriter, useLowAllocation, memoryMode);
9292
}
9393
}

0 commit comments

Comments
 (0)