tracer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSpanAttribute

func AddSpanAttribute(span trace.Span, key string, value interface{}) trace.Span

AttachHttpAttributesToSpanWithError attaches HTTP attributes to the span and records an error if present.

func AddSpanAttributeByContext

func AddSpanAttributeByContext(ctx context.Context, key string, value any) trace.Span

AddSpanAttributeByContext retrieves the span from the context and adds an attribute to it. If the span is not recording, it returns nil. This is useful for adding attributes to spans in a middleware or handler context. It is important to note that this function does not create a new span.

func AddSpanEvent

func AddSpanEvent(span trace.Span, opts *EventOptions) trace.Span

EventOptions contains options for adding events to spans.

func AddSpanEventByContext

func AddSpanEventByContext(ctx context.Context, opts *EventOptions) trace.Span

AddSpanEventByContext retrieves the span from the context and adds an event to it.

Types

type EventOptions

type EventOptions struct {
	Name           string
	Attributes     map[string]interface{}
	WithStackTrace bool
	WithTimestamp  time.Time
}

EventOptions holds the options for creating an event in tracer span. It includes the event name, attributes, and options for stack trace and timestamp.

func NewEventOptions

func NewEventOptions(
	name string,
	attrib map[string]interface{},
	withStackTrace bool,
	withTimeStamp time.Time,
) *EventOptions

NewEventOptions creates a new EventOptions instance with the provided name, attributes, and options.

Jump to

Keyboard shortcuts

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