tracing

package
v0.0.0-...-827b3f2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tracing enables [Datadog APM tracing](https://docs.datadoghq.com/tracing/) capabilities, focusing specifically on [Error Tracking](https://docs.datadoghq.com/tracing/error_tracking/)

Index

Constants

This section is empty.

Variables

View Source
var (
	StartSpanFromContext = tracer.StartSpanFromContext
	StartSpan            = tracer.StartSpan
	ChildOf              = tracer.ChildOf
	WithError            = tracer.WithError
	ContextWithSpan      = tracer.ContextWithSpan
)

reimport relevant bits of the tracer API

Functions

func GoPanicWrap

func GoPanicWrap(ctx context.Context, wg *sync.WaitGroup, name string, body func(context.Context))

GoPanicWrap extends PanicWrap by running the body in a goroutine and synchronizing the goroutine exit with the WaitGroup. The body must respect cancellation of the Context.

func Link(span tracer.Span, l *zap.Logger) *zap.Logger

Link connects a logger to a particular trace and span. DD APM should provide some additional functionality based on that.

func PanicWrap

func PanicWrap(ctx context.Context, name string, body func(context.Context))

PanicWrap executes the body guarding for panics. If panic happens it emits a span with the error attached. This should trigger DD APM's Error Tracking to record the error.

func SpanResource

func SpanResource(span Span, resource string)

func SpanTag

func SpanTag(span Span, key string, value interface{})

func SpanType

func SpanType(span Span, typ string)

func Start

func Start(version string, l *zap.Logger)

Start boots the datadog tracer, run this once early in the startup sequence.

func Stop

func Stop()

Stop shuts down the datadog tracer, defer this right after Start().

func Wrap

func Wrap(ctx context.Context, log *zap.Logger, operation string, action func(context.Context, *zap.Logger, Span) error) error

Wrap executes action in the context of a span. Tags the span with the error if action returns one.

Types

type Span

type Span = tracer.Span

Jump to

Keyboard shortcuts

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