trace

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_trace_trace_proto protoreflect.FileDescriptor

Functions

func SortSpansHierarchically

func SortSpansHierarchically(spans []*span.Span) []*span.Span

SortSpansHierarchically sorts a slice of spans hierarchically: parent first, then children. Within siblings, they are sorted by StartTime.

Types

type ContainsTraceSpansComparator

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

ContainsTraceSpansComparator compares expected and actual spans with contains matching (expected fields must be present in actual spans)

func (*ContainsTraceSpansComparator) Compare

func (c *ContainsTraceSpansComparator) Compare(expected []*span.ExpectedSpan, actual []*span.Span) (bool, string)

type EndsWithTraceSpansComparator

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

EndsWithTraceSpansComparator compares expected and actual spans with endsWith matching (expected fields must match the end of actual spans)

func (*EndsWithTraceSpansComparator) Compare

func (c *EndsWithTraceSpansComparator) Compare(expected []*span.ExpectedSpan, actual []*span.Span) (bool, string)

type ExpectedTrace

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

func NewExpectedTrace

func NewExpectedTrace(dto *parser.ExpectedTraceDTO) *ExpectedTrace

func NewExpectedTraces

func NewExpectedTraces(dtos []*parser.ExpectedTraceDTO) []*ExpectedTrace

func (*ExpectedTrace) String

func (e *ExpectedTrace) String() string

type ExpectedTraceProperties

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

type StartsWithTraceSpansComparator

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

StartsWithTraceSpansComparator compares expected and actual spans with startsWith matching (expected fields must match the beginning of actual spans)

func (*StartsWithTraceSpansComparator) Compare

func (c *StartsWithTraceSpansComparator) Compare(expected []*span.ExpectedSpan, actual []*span.Span) (bool, string)

type StrictTraceSpansComparator

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

StrictTraceSpansComparator compares expected and actual spans with strict matching (all fields must match)

func (*StrictTraceSpansComparator) Compare

func (c *StrictTraceSpansComparator) Compare(expected []*span.ExpectedSpan, actual []*span.Span) (bool, string)

type Trace

type Trace struct {
	TraceId    trigger.TraceId
	StartTime  time.Time
	EndTime    time.Time
	Duration   time.Duration
	SpanCount  int
	ErrorCount int
	Spans      []*span.Span
}

Trace represents a collection of spans defined with OpenTelemetry conventions

func NewTrace

func NewTrace(traceId trigger.TraceId, startTime time.Time, endTime time.Time, duration time.Duration, spanCount int, errorCount int, spans []*span.Span) *Trace

func (*Trace) Compare

func (t *Trace) Compare(expectedTrace *ExpectedTrace) (bool, string)

func (*Trace) CompareProperties

func (t *Trace) CompareProperties(expectedProperties *ExpectedTraceProperties) (bool, string)

func (*Trace) GetLastSpan

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

func (*Trace) String

func (t *Trace) String() string

func (*Trace) ToProto

func (t *Trace) ToProto() *TraceProto

type TraceAdapter

type TraceAdapter interface {
	Fetch(traceId trigger.TraceId, timeout time.Duration, retryDelay time.Duration, lastSpan *span.ExpectedSpan) (*Trace, error)
}

Adapter and Repository

type TraceComparator

type TraceComparator interface {
	Compare() (bool, error)
}

type TraceProto

type TraceProto struct {
	TraceId    string                 `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
	StartTime  *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	EndTime    *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	Duration   *durationpb.Duration   `protobuf:"bytes,4,opt,name=duration,proto3" json:"duration,omitempty"`
	SpanCount  int32                  `protobuf:"varint,5,opt,name=span_count,json=spanCount,proto3" json:"span_count,omitempty"`
	ErrorCount int32                  `protobuf:"varint,6,opt,name=error_count,json=errorCount,proto3" json:"error_count,omitempty"`
	Spans      []*span.SpanProto      `protobuf:"bytes,7,rep,name=spans,proto3" json:"spans,omitempty"`
	// contains filtered or unexported fields
}

func (*TraceProto) Descriptor deprecated

func (*TraceProto) Descriptor() ([]byte, []int)

Deprecated: Use TraceProto.ProtoReflect.Descriptor instead.

func (*TraceProto) GetDuration

func (x *TraceProto) GetDuration() *durationpb.Duration

func (*TraceProto) GetEndTime

func (x *TraceProto) GetEndTime() *timestamppb.Timestamp

func (*TraceProto) GetErrorCount

func (x *TraceProto) GetErrorCount() int32

func (*TraceProto) GetSpanCount

func (x *TraceProto) GetSpanCount() int32

func (*TraceProto) GetSpans

func (x *TraceProto) GetSpans() []*span.SpanProto

func (*TraceProto) GetStartTime

func (x *TraceProto) GetStartTime() *timestamppb.Timestamp

func (*TraceProto) GetTraceId

func (x *TraceProto) GetTraceId() string

func (*TraceProto) ProtoMessage

func (*TraceProto) ProtoMessage()

func (*TraceProto) ProtoReflect

func (x *TraceProto) ProtoReflect() protoreflect.Message

func (*TraceProto) Reset

func (x *TraceProto) Reset()

func (*TraceProto) String

func (x *TraceProto) String() string

type TraceSpansComparator

type TraceSpansComparator interface {
	Compare(expected []*span.ExpectedSpan, actual []*span.Span) (bool, string)
}

Comparator

func NewTraceSpansComparator

func NewTraceSpansComparator(checker string, ordered bool) TraceSpansComparator

Jump to

Keyboard shortcuts

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