From 43652ffbf2c0af277f3de1b32412c8bf575b9028 Mon Sep 17 00:00:00 2001 From: Nathaniel Ruiz Nowell Date: Thu, 24 Sep 2020 14:50:00 -0700 Subject: [PATCH] Require the SDK to provide custom ID generation --- CHANGELOG.md | 2 ++ spec-compliance-matrix.md | 1 + specification/trace/sdk.md | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50b8d5b9e96..9b121f105f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ Updates: - Resource's service.name MUST have a default value, service.instance.id is not required. ([#1269](https://github.com/open-telemetry/opentelemetry-specification/pull/1269)) +- Add requirement that the SDK allow custom generation of Trace IDs and Span IDs + ([#1006](https://github.com/open-telemetry/opentelemetry-specification/pull/1006)) ## v0.7.0 (11-18-2020) diff --git a/spec-compliance-matrix.md b/spec-compliance-matrix.md index 10119f9525b..0791d038c3e 100644 --- a/spec-compliance-matrix.md +++ b/spec-compliance-matrix.md @@ -69,6 +69,7 @@ status of the feature is not known. |Allow samplers to modify tracestate | | + | | + | | + | | + | | | + | |ShouldSample gets full parent Context | | + | + | + | | + | | | | | + | |[New Span ID created also for non-recording Spans](specification/trace/sdk.md#sdk-span-creation) | | | | + | | | | | | | + | +|SDK Trace & Span ID generation is customizable| + | + | + | + | | | | | | + | | ## Baggage diff --git a/specification/trace/sdk.md b/specification/trace/sdk.md index 8a2f394b862..e089a4283df 100644 --- a/specification/trace/sdk.md +++ b/specification/trace/sdk.md @@ -222,6 +222,23 @@ Note: Implementation-wise, this could mean that `Tracer` instances have a reference to their `TracerProvider` and access configuration only via this reference. +The SDK MUST by default randomly generate the bytes for both the `TraceId` and +the `SpanId`. + +The SDK MUST provide a mechanism for customizing the way IDs are generated for +both the `TraceId` and the `SpanId`. + +The SDK MAY provide this functionality by allowing custom implementations of +an interface like `IdsGenerator` below, which provides extension points for two +methods, one to generate a `SpanID` and one to generate a `TraceId`. + +``` +IdsGenerator { + String generateSpanId() + String generateTraceId() +} +``` + ### Shutdown This method provides a way for provider to do any cleanup required.