1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-22 20:06:07 +02:00

Add documentation for tracer.Start() (#1864)

Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
This commit is contained in:
Anthony Mirabella 2021-04-29 18:22:59 -04:00 committed by GitHub
parent 2bd4840c30
commit 08f4c2707f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -638,7 +638,19 @@ func (sk SpanKind) String() string {
// Tracer is the creator of Spans. // Tracer is the creator of Spans.
type Tracer interface { type Tracer interface {
// Start creates a span. // Start creates a span and a context.Context containing the newly-created span.
//
// If the context.Context provided in `ctx` contains a Span then the newly-created
// Span will be a child of that span, otherwise it will be a root span. This behavior
// can be overridden by providing `WithNewRoot()` as a SpanOption, causing the
// newly-created Span to be a root span even if `ctx` contains a Span.
//
// When creating a Span it is recommended to provide all known span attributes using
// the `WithAttributes()` SpanOption as samplers will only have access to the
// attributes provided when a Span is created.
//
// Any Span that is created MUST also be ended. This is the responsibility of the user.
// Implementations of this API may leak memory or other resources if Spans are not ended.
Start(ctx context.Context, spanName string, opts ...SpanOption) (context.Context, Span) Start(ctx context.Context, spanName string, opts ...SpanOption) (context.Context, Span)
} }