Closed liambutler-lawrence closed 3 weeks ago
hey @liambutler-lawrence
Indeed the docs are not up to date. I just a made a PR to reflect the changes.
For background, in past we have some tracers that couldn't handle the 2 ^ 63
hence we had to reduce the range by 1. This no longer the case with 128 bit ids and we can use the full range.
Question
In
DatadogInternal/Sources/NetworkInstrumentation/TraceID.swift
, withinstruct DefaultTraceIDGenerator
, the following constant declaration seems to have an incorrect doc comment:Issues:
UInt64.max
, according to both the documentation and empirical testing, evaluates to 2 ^ 64 - 1 (18446744073709551615), not 2 ^ 63 - 1 (9223372036854775807).DDId.java
.I also noticed that in
DatadogInternal/Sources/NetworkInstrumentation/SpanID.swift
, withinstruct DefaultSpanIDGenerator
there is a similar constant declaration that usesUInt64.max >> 1
(instead of justUInt64.max
) which does evaluate to 2 ^ 63 - 1. Should that be the case inDefaultTraceIDGenerator
as well?Also related, both
DefaultTraceIDGenerator
andDefaultSpanIDGenerator
use arepeat {} while {}
loop to skip generated values of0
, but those are already eliminated since the range starts at 1, not 0. Isn't that unnecessary code then?