tracing

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 7 Imported by: 0

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

View Source
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

View Source
const (
	AttrValueExecNameRio           = "rio"
	AttrValueExecNameGit           = "git"
	AttrValueExecNameRunc          = "runc"
	AttrValueExecOperationGitClone = "clone"
	AttrValueExecOperationGitLs    = "ls"
)

Attribute values

Variables

Enumerated attributes

Functions

func EndWithStatus

func EndWithStatus(span trace.Span, err error)

func Printable

func Printable(s string) string

Printable returns the input with only printable characters as defined by unicode.IsGraphic

func PrintableAttribute

func PrintableAttribute(key string, value string) attribute.KeyValue

PrintableAttribute creates an attribute.KeyValue with only printable characters from the value

func SetSpanError

func SetSpanError(ctx context.Context, err error)

SetSpanError is a helper function to set the span error based on a serum error.

func SetTracer

func SetTracer(ctx context.Context, tracer trace.Tracer) context.Context

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.

func TracerFromCtx

func TracerFromCtx(ctx context.Context) trace.Tracer

TracerFromCtx returns the tracer set for the current context. If no tracer is currently set in ctx, a new no-op tracer will be returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL