Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk-tracer: replace Factory with Provider #422

Merged
merged 3 commits into from
Jan 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions specification/sdk-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,15 @@ of the `TraceID`.

## Tracer Creation

New `Tracer` instances are always created through a `TracerFactory` (see [API](api-tracing.md#obtaining-a-tracer)).
The `name` and `version` arguments supplied to the `TracerFactory` must be used
to create a `Resource` instance which is stored on the created `Tracer`.
New `Tracer` instances are always created through a `TracerProvider` (see
[API](api-tracing.md#obtaining-a-tracer)). The `name` and `version` arguments
supplied to the `TracerProvider` must be used to create a
[`Resource`](sdk-resource.md) instance which is stored on the created `Tracer`.

All configuration objects (SDK specific) and extension points (span processors,
propagators) must be provided to the `TracerFactory`. `Tracer` instances must
propagators) must be provided to the `TracerProvider`. `Tracer` instances must
not duplicate this data (unless for read-only access) to avoid that different
`Tracer` instances of a `TracerFactory` have different versions of these data.
`Tracer` instances of a `TracerProvider` have different versions of these data.

The readable representations of all `Span` instances created by a `Tracer` must
provide a `getLibraryResource` method that returns this `Resource` information
Expand All @@ -149,20 +150,20 @@ invocations. The span processors are invoked only when
Built-in span processors are responsible for batching and conversion of spans to
exportable representation and passing batches to exporters.

Span processors can be registered directly on SDK `TracerFactory` and they are
Span processors can be registered directly on SDK `TracerProvider` and they are
invoked in the same order as they were registered.

All `Tracer` instances created by a `TracerFactory` share the same span processors.
All `Tracer` instances created by a `TracerProvider` share the same span processors.
Changes to this collection reflect in all `Tracer` instances.
Implementation-wise, this could mean that `Tracer` instances have a reference to
their `TracerFactory` and can access span processor objects only via this
their `TracerProvider` and can access span processor objects only via this
reference.

Manipulation of the span processors collection must only happen on `TracerFactory`
Manipulation of the span processors collection must only happen on `TracerProvider`
instances. This means methods like `addSpanProcessor` must be implemented on
`TracerFactory`.
`TracerProvider`.

Each processor registered on `TracerFactory` is a start of pipeline that consist
Each processor registered on `TracerProvider` is a start of pipeline that consist
of span processor and optional exporter. SDK MUST allow to end each pipeline with
individual exporter.

Expand Down