Skip to content

Commit 577c076

Browse files
committed
suggestion
1 parent adeb586 commit 577c076

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void addTrace(List<? extends CoreSpan<?>> trace) {
6868
// there are alternative approaches to avoid blocking here, such as
6969
// introducing an unbound queue and another thread to do the IO
7070
// however, we can't block the application threads from here.
71-
if (null == mapper || null == packer || !packer.format(trace, mapper)) {
71+
if (null == mapper || !packer.format(trace, mapper)) {
7272
healthMetrics.onFailedPublish(
7373
trace.isEmpty() ? 0 : trace.get(0).samplingPriority(), trace.size());
7474
}
@@ -79,14 +79,13 @@ private void selectMapper() {
7979
if (mapperDiscovery.getMapper() == null) {
8080
mapperDiscovery.discover();
8181
}
82-
8382
mapper = mapperDiscovery.getMapper();
84-
if (null != mapper && null == packer) {
85-
batchTimer =
86-
monitoring.newTimer("tracer.trace.buffer.fill.time", "endpoint:" + mapper.endpoint());
87-
packer = new MsgPackWriter(new FlushingBuffer(mapper.messageBufferSize(), this));
88-
batchTimer.start();
89-
}
83+
}
84+
if (null == packer && null != mapper) {
85+
batchTimer =
86+
monitoring.newTimer("tracer.trace.buffer.fill.time", "endpoint:" + mapper.endpoint());
87+
packer = new MsgPackWriter(new FlushingBuffer(mapper.messageBufferSize(), this));
88+
batchTimer.start();
9089
}
9190
}
9291

0 commit comments

Comments
 (0)