Skip to content

Commit d8dcccb

Browse files
fix compilation 3
1 parent 17a3dd7 commit d8dcccb

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

dd-trace-core/src/main/java/datadog/trace/common/writer/PayloadDispatcherImpl.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ public void accept(int messageCount, ByteBuffer buffer) {
135135
sendDetails.put("trace_count", messageCount);
136136
sendDetails.put("payload_size_bytes", sizeInBytes);
137137
sendDetails.put("success", response.success());
138-
if (response.exception() != null) {
139-
sendDetails.put("exception", response.exception().getClass().getName());
140-
sendDetails.put("exception_message", response.exception().getMessage());
141-
}
142-
if (response.status() != null) {
143-
sendDetails.put("http_status", response.status());
144-
}
138+
response.exception().ifPresent(ex -> {
139+
sendDetails.put("exception", ex.getClass().getName());
140+
sendDetails.put("exception_message", ex.getMessage());
141+
});
142+
response.status().ifPresent(status -> sendDetails.put("http_status", status));
145143

146144
Assert.always(
147145
response.success(),
@@ -158,13 +156,11 @@ public void accept(int messageCount, ByteBuffer buffer) {
158156
ObjectNode failureDetails = JsonNodeFactory.instance.objectNode();
159157
failureDetails.put("trace_count", messageCount);
160158
failureDetails.put("payload_size_bytes", sizeInBytes);
161-
if (response.exception() != null) {
162-
failureDetails.put("exception", response.exception().getClass().getName());
163-
failureDetails.put("exception_message", response.exception().getMessage());
164-
}
165-
if (response.status() != null) {
166-
failureDetails.put("http_status", response.status());
167-
}
159+
response.exception().ifPresent(ex -> {
160+
failureDetails.put("exception", ex.getClass().getName());
161+
failureDetails.put("exception_message", ex.getMessage());
162+
});
163+
response.status().ifPresent(status -> failureDetails.put("http_status", status));
168164

169165
Assert.unreachable(
170166
"Trace sending failure path should never be reached - indicates traces are being lost",

dd-trace-core/src/main/java/datadog/trace/common/writer/RemoteWriter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public void write(final List<DDSpan> trace) {
8888
// Antithesis: Track when traces are dropped due to writer being closed
8989
ObjectNode shutdownDetails = JsonNodeFactory.instance.objectNode();
9090
shutdownDetails.put("trace_size", trace.size());
91-
shutdownDetails.put("span_count", trace.stream().mapToInt(List::size).sum());
9291
shutdownDetails.put("reason", "writer_closed_during_shutdown");
9392

9493
Assert.sometimes(
@@ -120,7 +119,6 @@ public void write(final List<DDSpan> trace) {
120119
// Antithesis: Buffer overflow should NEVER happen - this indicates a serious problem
121120
ObjectNode overflowDetails = JsonNodeFactory.instance.objectNode();
122121
overflowDetails.put("trace_size", trace.size());
123-
overflowDetails.put("span_count", trace.stream().mapToInt(List::size).sum());
124122
overflowDetails.put("sampling_priority", samplingPriority);
125123
overflowDetails.put("buffer_capacity", traceProcessingWorker.getCapacity());
126124
overflowDetails.put("reason", "buffer_overflow_backpressure");

0 commit comments

Comments
 (0)