Skip to content

Commit

Permalink
Clarify IdsGenerator, same requirement for vendor specific code like …
Browse files Browse the repository at this point in the history
…Propagators (#1408)

* Clarify IdsGenerator, same requirement for vendor specific code like propagators

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

* Update specification/trace/sdk.md

Co-authored-by: John Watson <jkwatson@gmail.com>

* Update specification/trace/sdk.md

Co-authored-by: John Watson <jkwatson@gmail.com>

* Update specification/trace/sdk.md

Co-authored-by: John Watson <jkwatson@gmail.com>

* Update specification/trace/sdk.md

Co-authored-by: John Watson <jkwatson@gmail.com>

* Small link fixes

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Co-authored-by: John Watson <jkwatson@gmail.com>
  • Loading branch information
bogdandrutu and jkwatson authored Feb 8, 2021
1 parent 2f63e91 commit 716dc9e
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [Tracer Provider](#tracer-provider)
* [Additional Span Interfaces](#additional-span-interfaces)
* [Limits on Span Collections](#limits-on-span-collections)
* [Id Generator](#id-generators)
* [Span Processor](#span-processor)
* [Span Exporter](#span-exporter)

Expand Down Expand Up @@ -211,9 +212,9 @@ supplied to the `TracerProvider` must be used to create an
[`InstrumentationLibrary`][otep-83] instance which is stored on the created
`Tracer`.

Configuration (i.e., [Span processors](#span-processor) and [`Sampler`](#sampling))
MUST be managed solely by the `TracerProvider` and it MUST provide some way to
configure them, at least when creating or initializing it.
Configuration (i.e., [Span processors](#span-processor), [IdGenerator](#id-generators),
and [`Sampler`](#sampling)) MUST be managed solely by the `TracerProvider` and it
MUST provide some way to configure them, at least when creating or initializing it.

The TracerProvider MAY provide methods to update the configuration. If
configuration is updated (e.g., adding a `SpanProcessor`),
Expand All @@ -224,23 +225,6 @@ 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.
Expand Down Expand Up @@ -317,6 +301,30 @@ There SHOULD be a log emitted to indicate to the user that an attribute, event,
or link was discarded due to such a limit. To prevent excessive logging, the log
should not be emitted once per span, or per discarded attribute, event, or links.

## Id Generators

The SDK MUST by default randomly generate 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 the java example below (name of the interface MAY be
`IdGenerator`, name of the methods MUST be consistent with
[SpanContext](./api.md#retrieving-the-traceid-and-spanid)), which provides
extension points for two methods, one to generate a `SpanID` and one for `TraceId`.

```java
public interface IdGenerator {
byte[] generateSpanIdBytes();
byte[] generateTraceIdBytes();
}
```

Additional `IdGenerator` implementing vendor-specific protocols such as AWS
X-Ray trace id generator MUST NOT be maintained or distributed as part of the
Core OpenTelemetry repositories.

## Span processor

Span processor is an interface which allows hooks for span start and end method
Expand Down

0 comments on commit 716dc9e

Please sign in to comment.