Documentation
¶
Index ¶
- func AddSpanAttribute(span trace.Span, key string, value interface{}) trace.Span
- func AddSpanAttributeByContext(ctx context.Context, key string, value any) trace.Span
- func AddSpanEvent(span trace.Span, opts *EventOptions) trace.Span
- func AddSpanEventByContext(ctx context.Context, opts *EventOptions) trace.Span
- type EventOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSpanAttribute ¶
AttachHttpAttributesToSpanWithError attaches HTTP attributes to the span and records an error if present.
func AddSpanAttributeByContext ¶
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.