Documentation
¶
Overview ¶
Tracing is a package that wraps go.opentelemetry.io/otel/trace for setting and retrieving tracers in a context.Context
This package aids in tracing instrumentation by using context for tracing instrumentation instead of using package global variables.
Index ¶
- Constants
- Variables
- func EndWithStatus(span trace.Span, err error)
- func Printable(s string) string
- func PrintableAttribute(key string, value string) attribute.KeyValue
- func SetSpanError(ctx context.Context, err error)
- func SetTracer(ctx context.Context, tracer trace.Tracer) context.Context
- func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func TracerFromCtx(ctx context.Context) trace.Tracer
Constants ¶
const ( AttrKeyWarpforgeErrorCode = "warpforge.error.code" AttrKeyWarpforgeFormulaId = "warpforge.formula.id" AttrKeyWarpforgeIngestHash = "warpforge.ingest.hash" AttrKeyWarpforgeIngestPath = "warpforge.ingest.path" AttrKeyWarpforgeIngestRev = "warpforge.ingest.rev" AttrKeyWarpforgeStepName = "warpforge.step.name" AttrKeyWarpforgeWareId = "warpforge.ware.id" AttrKeyWarpforgeExecName = "warpforge.exec.name" AttrKeyWarpforgeExecOperation = "warpforge.exec.operation" )
Span attribute keys used by warpforge
const ( AttrValueExecNameRio = "rio" AttrValueExecNameGit = "git" AttrValueExecNameRunc = "runc" AttrValueExecOperationGitClone = "clone" AttrValueExecOperationGitLs = "ls" )
Attribute values
Variables ¶
var ( AttrFullExecNameRio = attribute.String(AttrKeyWarpforgeExecName, AttrValueExecNameRio) AttrFullExecNameGit = attribute.String(AttrKeyWarpforgeExecName, AttrValueExecNameGit) AttrFullExecNameRunc = attribute.String(AttrKeyWarpforgeExecName, AttrValueExecNameRunc) AttrFullExecOperationGitClone = attribute.String(AttrKeyWarpforgeExecOperation, AttrValueExecOperationGitClone) AttrFullExecOperationGitLs = attribute.String(AttrKeyWarpforgeExecOperation, AttrValueExecOperationGitLs) )
Enumerated attributes
Functions ¶
func EndWithStatus ¶
func Printable ¶
Printable returns the input with only printable characters as defined by unicode.IsGraphic
func PrintableAttribute ¶
PrintableAttribute creates an attribute.KeyValue with only printable characters from the value
func SetSpanError ¶
SetSpanError is a helper function to set the span error based on a serum error.
func SetTracer ¶
SetTracer returns a new context with the given tracer associated with it. Setting the tracer to nil will create a noop tracer and insert it into the context.
func Start ¶
func Start(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Start is a shortcut for retrieving the context tracer and calling Start. Start creates a span and a context.Context containing the newly-created span.
If the current context does not contain a tracer then a new no-op tracer will be created for the new context. See go.opentelemetry.io/otel/trace.Tracer.Start for more information on the Start function.
Types ¶
This section is empty.