tracing

package
v0.0.0-...-dd34b7f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK    = "OK"
	StatusError = "Error"
	StatusUnset = "Unset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceInfo

type ResourceInfo struct {
	ServiceName    string `json:"service.name"`
	ServiceVersion string `json:"service.version"`
}

type Span

type Span struct {
	SpanID       string            `json:"spanId"`
	ParentSpanID *string           `json:"parentSpanId,omitempty"`
	Name         string            `json:"name"`
	Kind         string            `json:"kind"`
	StartTime    time.Time         `json:"startTime"`
	EndTime      time.Time         `json:"endTime"`
	Attributes   map[string]string `json:"attributes"`
	Status       SpanStatus        `json:"status"`
}

func NewSpan

func NewSpan(name, kind string, parentID *string, startTime, endTime time.Time) Span

func (*Span) OnDone

func (s *Span) OnDone()

func (*Span) SetStatus

func (s *Span) SetStatus(err error)

SetStatus updates the status of the span based on the provided error.

func (*Span) SetStatusFromHTTPCode

func (s *Span) SetStatusFromHTTPCode(code int)

SetStatusFromHTTPCode updates the span's status based on the HTTP response code.

func (*Span) WithAttributes

func (s *Span) WithAttributes(attrs map[string]string) *Span

type SpanStatus

type SpanStatus struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Trace

type Trace struct {
	TraceID  string        `json:"traceId"`
	Spans    []*Span       `json:"spans"`
	Resource *ResourceInfo `json:"resource"`
}

func NewTrace

func NewTrace(serviceName, serviceVersion string) *Trace

func (*Trace) Append

func (t *Trace) Append(span ...*Span)

Jump to

Keyboard shortcuts

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