File tree Expand file tree Collapse file tree
dd-trace/src/main/java/com/datadoghq/trace Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ public final void finish() {
5050 }
5151
5252 public final void finish (final long stoptimeMicros ) {
53- this .durationNano = TimeUnit .MICROSECONDS .toNanos (stoptimeMicros - this .startTimeMicro );
53+ // Ensure that duration is at least 1. Less than 1 is possible due to our use of system clock instead of nano time.
54+ this .durationNano =
55+ Math .max (1 , TimeUnit .MICROSECONDS .toNanos (stoptimeMicros - this .startTimeMicro ));
5456 afterFinish ();
5557 }
5658
Original file line number Diff line number Diff line change @@ -223,15 +223,16 @@ private DDSpan startSpan() {
223223
224224 @ Override
225225 public ActiveSpan startActive () {
226- final ActiveSpan activeSpan = spanSource .makeActive (startSpan ());
227- log .debug ("{} - Starting a new active span." , activeSpan );
226+ final DDSpan span = startSpan ();
227+ final ActiveSpan activeSpan = spanSource .makeActive (span );
228+ log .debug ("Starting a new active span: {}" , span );
228229 return activeSpan ;
229230 }
230231
231232 @ Override
232233 public DDSpan startManual () {
233234 final DDSpan span = startSpan ();
234- log .debug ("{} - Starting a new manuel span. " , span );
235+ log .debug ("Starting a new manual span: {} " , span );
235236 return span ;
236237 }
237238
Original file line number Diff line number Diff line change @@ -141,11 +141,13 @@ public void run() {
141141 final Future <Long > future = executor .submit (new SendingTask ());
142142 try {
143143 final long nbTraces = future .get (API_TIMEOUT_SECONDS , TimeUnit .SECONDS );
144- log .debug ("Successfully sending {} traces to the API" , nbTraces );
144+ if (nbTraces > 0 ) {
145+ log .debug ("Successfully sent {} traces to the API" , nbTraces );
146+ }
145147 } catch (final TimeoutException e ) {
146- log .debug ("Timeout! Fail to send traces to the API: {}" , e .getMessage ());
148+ log .debug ("Timeout! Failed to send traces to the API: {}" , e .getMessage ());
147149 } catch (final Throwable e ) {
148- log .debug ("Fail to send traces to the API: {}" , e .getMessage ());
150+ log .debug ("Failed to send traces to the API: {}" , e .getMessage ());
149151 }
150152 }
151153
You can’t perform that action at this time.
0 commit comments