Zipkin 1.15
Zipkin 1.15 completes the transition to support 128-bit trace IDs, notably considering high resolution ids when querying and grouping traces.
Regular zipkin usage is unimpacted as this is all behind the scenes. However, the below details will be interesting to some and particularly of note during any transition from 64-128 bit trace IDs.
128-bit trace IDs
Zipkin supports 64 and 128-bit trace identifiers, typically serialized
as 16 or 32 character hex strings. By default, spans reported to zipkin
with the same trace ID will be considered in the same trace.
For example, 463ac35c9f6413ad48485a3953bb6124
is a 128-bit trace ID,
while 48485a3953bb6124
is a 64-bit one.
Note: Span (or parent) IDs within a trace are 64-bit regardless of the
length or value of their trace ID.
Migrating from 64 to 128-bit trace IDs
Unless you only issue 128-bit traces when all applications support them,
the process of updating applications from 64 to 128-bit trace IDs results
in a mixed state. This mixed state is mitigated by the setting
STRICT_TRACE_ID=false
, explained below. Once a migration is complete,
remove the setting STRICT_TRACE_ID=false
or set it to true.
Here are a few trace IDs the help what happens during this setting.
- Trace ID A: 463ac35c9f6413ad48485a3953bb6124
- Trace ID B: 48485a3953bb6124
- Trace ID C: 463ac35c9f6413adf1a48a8cff464e0e
- Trace ID D: 463ac35c9f6413ad
In a 64-bit environment, trace IDs will look like B or D above. When an
application upgrades to 128-bit instrumentation and decides to create a
128-bit trace, its trace IDs will look like A or C above.
Applications who aren't yet 128-bit capable typically only retain the
right-most 16 characters of the trace ID. When this happens, the same
trace could be reported as trace ID A or trace ID B.
By default, Zipkin will think these are different trace IDs, as they are
different strings. During a transition from 64-128 bit trace IDs, spans
would appear split across two IDs. For example, it might start as trace
ID A, but the next hop might truncate it to trace ID B. This would render
the system unusable for applications performing upgrades.
One way to address this problem is to not use 128-bit trace IDs until
all applications support them. This prevents a mixed scenario at the cost
of coordination. Another way is to set STRICT_TRACE_ID=false
.
When STRICT_TRACE_ID=false
, only the right-most 16 of a 32 character
trace ID are considered when grouping or retrieving traces. This setting
should only be applied when transitioning from 64 to 128-bit trace IDs
and removed once the transition is complete.
See openzipkin/b3-propagation#6 for the status
of known open source libraries on 128-bit trace identifiers.
Cassandra
There's no impact to the cassandra
(Cassandra 2.x) schema. The experimental cassandra3
schema has changed and needs to be recreated.
Elasticsearch
When STRICT_TRACE_ID=false
, the indexing template will be less efficient as it tokenizes trace IDs. Don't set STRICT_TRACE_ID=false
unless you really need to.
MySQL
There are no schema changes since last versions, but you'll likely want to add indexes in consideration of 128bit trace IDs.
ALTER TABLE zipkin_spans ADD INDEX(`trace_id_high`, `trace_id`, `id`);
ALTER TABLE zipkin_spans ADD INDEX(`trace_id_high`, `trace_id`);
ALTER TABLE zipkin_annotations ADD INDEX(`trace_id_high`, `trace_id`, `span_id`);
ALTER TABLE zipkin_annotations ADD INDEX(`trace_id_high`, `trace_id`);
Java Api
The STRICT_TRACE_ID
variable above corresponds to zipkin.storage.StorageComponent.Builder.strictTraceId
. Those using storage components directly will want to set this to false under similar circumstances to those described above.
We've added methods to SpanStore
, in support of high-resolution gets. Traces with 64-bit ids are retrieved by simply passing 0 as traceIdHigh.
@Nullable
List<Span> getTrace(long traceIdHigh, long traceIdLow);
@Nullable
List<Span> getRawTrace(long traceIdHigh, long traceIdLow);