Skip to content

Commit

Permalink
Add documentation for tracer.Start() (open-telemetry#1864)
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
  • Loading branch information
Aneurysm9 authored Apr 29, 2021
1 parent 2bd4840 commit 08f4c27
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,19 @@ func (sk SpanKind) String() string {

// Tracer is the creator of Spans.
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)
}

Expand Down

0 comments on commit 08f4c27

Please sign in to comment.