traces

package
v0.15.17-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 21 Imported by: 5

Documentation

Index

Constants

View Source
const (
	TracetestMetadataFieldStartTime         string = "tracetest.span.start_time"
	TracetestMetadataFieldEndTime           string = "tracetest.span.end_time"
	TracetestMetadataFieldDuration          string = "tracetest.span.duration"
	TracetestMetadataFieldType              string = "tracetest.span.type"
	TracetestMetadataFieldName              string = "tracetest.span.name"
	TracetestMetadataFieldParentID          string = "tracetest.span.parent_id"
	TracetestMetadataFieldKind              string = "tracetest.span.kind"
	TracetestMetadataFieldStatusCode        string = "tracetest.span.status_code"
	TracetestMetadataFieldStatusDescription string = "tracetest.span.status_description"
)
View Source
const (
	NANOSECOND_SCALE  = 0
	MICROSECOND_SCALE = 1
	MILLISECOND_SCALE = 2
	SECOND_SCALE      = 3
	MINUTE_SCALE      = 4
	HOUR_SCALE        = 5
)
View Source
const TemporaryRootSpanName = "Temporary Tracetest root span"
View Source
const TriggerSpanName = "Tracetest trigger"

Variables

This section is empty.

Functions

func ConvertNanoSecondsIntoProperTimeUnit

func ConvertNanoSecondsIntoProperTimeUnit(value int) string

func ConvertTimeFieldIntoNanoSeconds

func ConvertTimeFieldIntoNanoSeconds(value string) int

func CreateTraceID

func CreateTraceID(id []byte) trace.TraceID

func DecodeTraceID

func DecodeTraceID(id string) trace.TraceID

Types

type Attributes

type Attributes struct {
	// contains filtered or unexported fields
}

func NewAttributes added in v0.14.7

func NewAttributes(inputs ...map[string]string) Attributes

func (Attributes) Delete added in v0.14.7

func (a Attributes) Delete(key string)

func (Attributes) Get

func (a Attributes) Get(key string) string

func (Attributes) GetExists added in v0.14.7

func (a Attributes) GetExists(key string) (string, bool)

func (Attributes) Len added in v0.14.7

func (a Attributes) Len() int

func (Attributes) MarshalJSON added in v0.14.7

func (a Attributes) MarshalJSON() ([]byte, error)

func (Attributes) Set added in v0.14.7

func (a Attributes) Set(key, value string)

func (Attributes) SetPointerValue

func (a Attributes) SetPointerValue(key string, value *string)

func (*Attributes) UnmarshalJSON added in v0.14.7

func (a *Attributes) UnmarshalJSON(in []byte) error

func (Attributes) Values added in v0.14.7

func (a Attributes) Values() map[string]string

type ConversionConfig

type ConversionConfig struct {
	// contains filtered or unexported fields
}

func NewConversionConfig

func NewConversionConfig() ConversionConfig

func (ConversionConfig) AddTimeFields

func (c ConversionConfig) AddTimeFields(fields ...string)

func (ConversionConfig) IsTimeField

func (c ConversionConfig) IsTimeField(field string) bool

type HttpResourceSpans

type HttpResourceSpans struct {
	v1.ResourceSpans
	ScopeSpans                  []*httpScopeSpans `json:"scopeSpans"`
	InstrumentationLibrarySpans []*httpScopeSpans `json:"instrumentationLibrarySpans"`
}

type Span

type Span struct {
	ID         trace.SpanID
	Name       string
	StartTime  time.Time
	EndTime    time.Time
	Attributes Attributes
	Kind       SpanKind
	Events     []SpanEvent
	Status     *SpanStatus

	Parent   *Span   `json:"-"`
	Children []*Span `json:"-"`
}

func AugmentRootSpan

func AugmentRootSpan(span Span, result trigger.TriggerResult) Span

func ConvertOtelSpanIntoSpan

func ConvertOtelSpanIntoSpan(span *v1.Span) *Span

func (Span) IsZero

func (s Span) IsZero() bool

func (Span) MarshalJSON

func (s Span) MarshalJSON() ([]byte, error)

func (*Span) UnmarshalJSON

func (s *Span) UnmarshalJSON(data []byte) error

type SpanEvent

type SpanEvent struct {
	Name       string     `json:"name"`
	Timestamp  time.Time  `json:"timestamp"`
	Attributes Attributes `json:"attributes"`
}

type SpanKind

type SpanKind string
var (
	SpanKindClient       SpanKind = "client"
	SpanKindServer       SpanKind = "server"
	SpanKindConsumer     SpanKind = "consumer"
	SpanKindProducer     SpanKind = "producer"
	SpanKindInternal     SpanKind = "internal"
	SpanKindUnespecified SpanKind = "unespecified"
)

type SpanStatus

type SpanStatus struct {
	Code        string
	Description string
}

type Spans

type Spans []Span

func (Spans) ForEach

func (s Spans) ForEach(fn func(ix int, _ Span) bool) Spans

func (Spans) OrEmpty

func (s Spans) OrEmpty(fn func()) Spans

type Trace

type Trace struct {
	ID       trace.TraceID
	RootSpan Span
	Flat     map[trace.SpanID]*Span `json:"-"`
}

func FromHttpOtelResourceSpans

func FromHttpOtelResourceSpans(resourceSpans []*HttpResourceSpans) Trace

func FromOtel

func FromOtel(input *v1.TracesData) Trace

func FromOtelResourceSpans

func FromOtelResourceSpans(resourceSpans []*v1.ResourceSpans) Trace

func FromSpanList

func FromSpanList(input []*v1.Span) Trace

func MergeTraces

func MergeTraces(traces ...*Trace) *Trace

func NewTrace

func NewTrace(traceID string, spans []Span) Trace

func (*Trace) HasRootSpan

func (t *Trace) HasRootSpan() bool

func (*Trace) InsertRootSpan

func (t *Trace) InsertRootSpan(newRoot Span) *Trace

func (Trace) MarshalJSON

func (t Trace) MarshalJSON() ([]byte, error)

func (*Trace) Sort

func (t *Trace) Sort() Trace

func (*Trace) Spans

func (t *Trace) Spans() []Span

func (*Trace) UnmarshalJSON

func (t *Trace) UnmarshalJSON(data []byte) error

type TraceRepository

type TraceRepository struct {
	// contains filtered or unexported fields
}

func NewTraceRepository

func NewTraceRepository(db *sql.DB) *TraceRepository

func (*TraceRepository) Get

func (r *TraceRepository) Get(ctx context.Context, id trace.TraceID) (Trace, error)

func (*TraceRepository) UpdateTraceSpans

func (r *TraceRepository) UpdateTraceSpans(ctx context.Context, trace *Trace) error

Jump to

Keyboard shortcuts

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