File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
main/java/datadog/trace/core
test/groovy/datadog/trace/core Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 5
5
import static datadog .trace .api .cache .RadixTreeCache .HTTP_STATUSES ;
6
6
import static datadog .trace .bootstrap .instrumentation .api .ErrorPriorities .UNSET ;
7
7
8
+ import datadog .trace .api .DDSpanId ;
8
9
import datadog .trace .api .DDTags ;
9
10
import datadog .trace .api .DDTraceId ;
10
11
import datadog .trace .api .Functions ;
@@ -892,9 +893,9 @@ public String toString() {
892
893
.append ("DDSpan [ t_id=" )
893
894
.append (traceId )
894
895
.append (", s_id=" )
895
- .append (spanId )
896
+ .append (DDSpanId . toString ( spanId ) )
896
897
.append (", p_id=" )
897
- .append (parentId )
898
+ .append (DDSpanId . toString ( parentId ) )
898
899
.append (" ] trace=" )
899
900
.append (getServiceName ())
900
901
.append ('/' )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import static datadog.trace.core.DDSpanContext.SPAN_SAMPLING_MAX_PER_SECOND_TAG
19
19
class DDSpanContextTest extends DDCoreSpecification {
20
20
21
21
def writer
22
- def tracer
22
+ CoreTracer tracer
23
23
def profilingContextIntegration
24
24
25
25
def setup () {
@@ -289,6 +289,29 @@ class DDSpanContextTest extends DDCoreSpecification {
289
289
" _dd.${ tag} .json"
290
290
}
291
291
292
+ def " Span IDs printed as unsigned long" () {
293
+ setup :
294
+ def parent = tracer. buildSpan(" fakeOperation" )
295
+ .withServiceName(" fakeService" )
296
+ .withResourceName(" fakeResource" )
297
+ .withSpanId(-987654321 )
298
+ .start()
299
+
300
+ def span = tracer. buildSpan(" fakeOperation" )
301
+ .withServiceName(" fakeService" )
302
+ .withResourceName(" fakeResource" )
303
+ .withSpanId(-123456789 )
304
+ .asChildOf(parent. context())
305
+ .start()
306
+
307
+ def context = span. context() as DDSpanContext
308
+
309
+ expect
660D
span>:
310
+ // even though span ID and parent ID are setup as negative numbers, they should be printed as their unsigned value
311
+ // asserting there is no negative sign after ids is the best I can do.
312
+ context. toString(). contains(" id=-" ) == false
313
+ }
314
+
292
315
static void assertTagmap (Map source , Map comparison , boolean removeThread = false ) {
293
316
def sourceWithoutCommonTags = new HashMap (source)
294
317
sourceWithoutCommonTags. remove(" runtime-id" )
You can’t perform that action at this time.
0 commit comments