tracing
API
tracing
packageAPI reference for the tracing
package.
Imports
(1)
I
interface
Span
Span represents a tracing span that can be ended and annotated.
pkg/tracing/tracer.go:8-12
type Span interface
Methods
End
Method
func End(...)
S
struct
Attribute
Attribute is a key-value pair for span metadata.
pkg/tracing/tracer.go:15-18
type Attribute struct
Fields
| Name | Type | Description |
|---|---|---|
| Key | string | |
| Value | any |
I
interface
Tracer
Tracer creates new spans.
pkg/tracing/tracer.go:21-23
type Tracer interface
Methods
S
noopSpan
pkg/tracing/tracer.go:25-25
type noopSpan struct
Methods
End
Method
func (noopSpan) End()
{}
S
noopTracer
pkg/tracing/tracer.go:31-31
type noopTracer struct
Methods
StartSpan
Method
Parameters
ctx
context.Context
name
string
Returns
func (noopTracer) StartSpan(ctx context.Context, name string) (context.Context, Span)
{
return ctx, noopSpan{}
}
F
function
StartSpan
StartSpan starts a span from the given tracer, falling back to Noop.
Parameters
Returns
pkg/tracing/tracer.go:41-46
func StartSpan(ctx context.Context, tracer Tracer, name string) (context.Context, Span)
{
if tracer == nil {
tracer = Noop
}
return tracer.StartSpan(ctx, name)
}