tracestorage

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package tracestorage defines storage structure for trace storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToTempoAttrs added in v0.0.8

func ConvertToTempoAttrs(to *tempoapi.Attributes, from otelstorage.Attrs)

ConvertToTempoAttrs converts otelstorage.Attrs to Tempo API attributes.

Types

type Consumer

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

Consumer consumes given traces and inserts them using given Inserter.

func NewConsumer

func NewConsumer(i Inserter) *Consumer

NewConsumer creates new Consumer.

func (*Consumer) ConsumeTraces

func (c *Consumer) ConsumeTraces(ctx context.Context, traces ptrace.Traces) error

ConsumeTraces implements otelreceiver.Consumer.

type Event

type Event struct {
	Timestamp otelstorage.Timestamp `json:"timestamp" yson:"timestamp"`
	Name      string                `json:"name" yson:"name"`
	Attrs     otelstorage.Attrs     `json:"attrs" yson:"attrs"`
}

Event is a Span event.

type Inserter

type Inserter interface {
	// InsertSpans inserts given spans.
	//
	// FIXME(tdakkota): probably, it's better to return some kind of batch writer.
	InsertSpans(ctx context.Context, spans []Span) error
	// InsertTags insert given set of tags to the storage.
	//
	// FIXME(tdakkota): probably, storage should do tag extraction by itself.
	InsertTags(ctx context.Context, tags map[Tag]struct{}) error
}

Inserter is a trace storage insert interface.

type Link struct {
	TraceID    otelstorage.TraceID `json:"trace_id" yson:"trace_id"`
	SpanID     otelstorage.SpanID  `json:"span_id" yson:"span_id"`
	TraceState string              `json:"trace_state" yson:"trace_state"`
	Attrs      otelstorage.Attrs   `json:"attrs" yson:"attrs"`
}

Link is a Span link.

type Querier

type Querier interface {
	// SearchTags performs search by given tags.
	SearchTags(ctx context.Context, tags map[string]string, opts SearchTagsOptions) (iterators.Iterator[Span], error)

	// TagNames returns all available tag names.
	TagNames(ctx context.Context) ([]string, error)
	// TagValues returns all available tag values for given tag.
	TagValues(ctx context.Context, tagName string) (iterators.Iterator[Tag], error)

	// TraceByID returns spans of given trace.
	TraceByID(ctx context.Context, id otelstorage.TraceID, opts TraceByIDOptions) (iterators.Iterator[Span], error)
}

Querier is a trace storage query interface.

type SearchTagsOptions

type SearchTagsOptions struct {
	MinDuration time.Duration
	MaxDuration time.Duration

	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start otelstorage.Timestamp
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End otelstorage.Timestamp
}

SearchTagsOptions defines options for SearchTags method.

type Span

type Span struct {
	TraceID       otelstorage.TraceID   `json:"trace_id" yson:"trace_id"`
	SpanID        otelstorage.SpanID    `json:"span_id" yson:"span_id"`
	TraceState    string                `json:"trace_state" yson:"trace_state"`
	ParentSpanID  otelstorage.SpanID    `json:"parent_span_id" yson:"parent_span_id"`
	Name          string                `json:"name" yson:"name"`
	Kind          int32                 `json:"kind" yson:"kind"`
	Start         otelstorage.Timestamp `json:"start" yson:"start"`
	End           otelstorage.Timestamp `json:"end" yson:"end"`
	Attrs         otelstorage.Attrs     `json:"attrs" yson:"attrs"`
	StatusCode    int32                 `json:"status_code" yson:"status_code"`
	StatusMessage string                `json:"status_message" yson:"status_message"`

	BatchID       string            `json:"batch_id" yson:"batch_id"`
	ResourceAttrs otelstorage.Attrs `json:"resource_attrs" yson:"resource_attrs"`

	ScopeName    string            `json:"scope_name" yson:"scope_name"`
	ScopeVersion string            `json:"scope_version" yson:"scope_version"`
	ScopeAttrs   otelstorage.Attrs `json:"scope_attrs" yson:"scope_attrs"`

	Events []Event `json:"events" yson:"events"`
	Links  []Link  `json:"links" yson:"links"`
}

Span is a data structure for span.

func NewSpanFromOTEL

func NewSpanFromOTEL(
	batchID string,
	res pcommon.Resource,
	scope pcommon.InstrumentationScope,
	span ptrace.Span,
) (s Span)

NewSpanFromOTEL creates new Span.

func (Span) AsTempoSpan

func (span Span) AsTempoSpan() (s tempoapi.TempoSpan)

AsTempoSpan converts span to TempoSpan.

func (Span) FillOTELSpan

func (span Span) FillOTELSpan(s ptrace.Span)

FillOTELSpan fills given OpenTelemetry span using span fields.

func (Span) FillTraceMetadata

func (span Span) FillTraceMetadata(m *tempoapi.TraceSearchMetadata)

FillTraceMetadata files TraceSearchMetadata fields using span.

The span should be a parent span.

func (Span) ServiceName added in v0.0.8

func (span Span) ServiceName() (string, bool)

ServiceName gets service name from attributes.

func (Span) YTSchema

func (Span) YTSchema() schema.Schema

YTSchema returns YTsaurus table schema for this structure.

type Tag

type Tag struct {
	Name  string `json:"name" yson:"name"`
	Value string `json:"value" yson:"value"`
	Type  int32  `json:"type" yson:"type"`
}

Tag is a data structure for tag.

func (Tag) YTSchema

func (Tag) YTSchema() schema.Schema

YTSchema returns YTsaurus table schema for this structure.

type TraceByIDOptions

type TraceByIDOptions struct {
	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start otelstorage.Timestamp
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End otelstorage.Timestamp
}

TraceByIDOptions defines options for TraceByID method.

Jump to

Keyboard shortcuts

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