trace

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package trace provides context-based span propagation for tracing operations.

This package offers the Start function to create spans that are automatically linked to parent spans found in the context. Spans represent units of work and can be organized in parent-child relationships, enabling measurement of how long operations take across function boundaries. The SetTraceID function enables distributed tracing by propagating a trace identifier across service boundaries.

Use this package when you need to instrument code with context-propagated tracing. For direct span manipulation, use the span subpackage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetExporter

func SetExporter(ctx context.Context, exp exporter.Exporter) context.Context

SetExporter stores an exporter in the context for span export.

func SetTraceID

func SetTraceID(ctx context.Context, traceID string) context.Context

SetTraceID stores a trace ID in the context for distributed tracing.

func Start

func Start(ctx context.Context, name string) (context.Context, *span.Span)

Start creates a new span with the given name and adds it to the parent span found in the context. If an exporter is set in the context, it will be invoked when the span ends.

Types

This section is empty.

Directories

Path Synopsis
Package attribute provides typed key-value pairs for annotating trace spans.
Package attribute provides typed key-value pairs for annotating trace spans.
Package event provides timestamped events that can be attached to trace spans.
Package event provides timestamped events that can be attached to trace spans.
Package exporter defines the interface for exporting trace spans.
Package exporter defines the interface for exporting trace spans.
Package span provides the Span type for representing units of work with timing information and hierarchical structure.
Package span provides the Span type for representing units of work with timing information and hierarchical structure.
Package status provides status codes for trace spans.
Package status provides status codes for trace spans.

Jump to

Keyboard shortcuts

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