 Documentation
      ¶
      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.
type Event ¶
type Event struct {
	Timestamp otelstorage.Timestamp `json:"timestamp"`
	Name      string                `json:"name"`
	Attrs     otelstorage.Attrs     `json:"attrs"`
}
    Event is a Span event.
type Inserter ¶
type Inserter interface {
	// SpanWriter creates a new batch.
	SpanWriter(ctx context.Context) (SpanWriter, error)
}
    Inserter is a trace storage insert interface.
type Link ¶
type Link struct {
	TraceID    otelstorage.TraceID `json:"trace_id"`
	SpanID     otelstorage.SpanID  `json:"span_id"`
	TraceState string              `json:"trace_state"`
	Attrs      otelstorage.Attrs   `json:"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, opts TagNamesOptions) ([]TagName, error)
	// TagValues returns all available tag values for given tag.
	TagValues(ctx context.Context, attr traceql.Attribute, opts TagValuesOptions) (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 time.Time
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End time.Time
}
    SearchTagsOptions defines options for [Querier.SearchTags].
type Span ¶
type Span struct {
	TraceID       otelstorage.TraceID   `json:"trace_id"`
	SpanID        otelstorage.SpanID    `json:"span_id"`
	TraceState    string                `json:"trace_state"`
	ParentSpanID  otelstorage.SpanID    `json:"parent_span_id"`
	Name          string                `json:"name"`
	Kind          int32                 `json:"kind"`
	Start         otelstorage.Timestamp `json:"start"`
	End           otelstorage.Timestamp `json:"end"`
	Attrs         otelstorage.Attrs     `json:"attrs"`
	StatusCode    int32                 `json:"status_code"`
	StatusMessage string                `json:"status_message"`
	BatchID       uuid.UUID         `json:"batch_id"`
	ResourceAttrs otelstorage.Attrs `json:"resource_attrs"`
	ScopeName    string            `json:"scope_name"`
	ScopeVersion string            `json:"scope_version"`
	ScopeAttrs   otelstorage.Attrs `json:"scope_attrs"`
	Events []Event `json:"events"`
	Links  []Link  `json:"links"`
}
    Span is a data structure for span.
func NewSpanFromOTEL ¶
func NewSpanFromOTEL( batchID uuid.UUID, res pcommon.Resource, scope pcommon.InstrumentationScope, span ptrace.Span, ) (s Span)
NewSpanFromOTEL creates new Span.
func (Span) AsTempoSpan ¶
AsTempoSpan converts span to TempoSpan.
func (Span) FillOTELSpan ¶
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
ServiceName gets service name from attributes.
type SpanWriter ¶ added in v0.15.0
type SpanWriter interface {
	// Add adds record to the batch.
	Add(span Span) error
	// Submit sends batch.
	Submit(ctx context.Context) error
	// Close frees resources.
	//
	// Callers should call [SpanWriter.Close] regardless if they called [SpanWriter.Submit] or not.
	Close() error
}
    SpanWriter represents a log record batch.
type Tag ¶
type Tag struct {
	Name  string                 `json:"name"`
	Value string                 `json:"value"`
	Type  traceql.StaticType     `json:"type"`
	Scope traceql.AttributeScope `json:"scope"`
}
    Tag is a data structure for tag.
func TagFromAttribute ¶ added in v0.15.0
TagFromAttribute creates a Tag from given pcommon.Value.
type TagName ¶ added in v0.12.0
type TagName struct {
	Scope traceql.AttributeScope
	Name  string
}
    TagNames is a set of tags by scope.
type TagNamesOptions ¶ added in v0.12.0
type TagNamesOptions struct {
	// Scope defines attribute scope to lookup.
	//
	// Querier should return attributes from all scopes, if it is zero.
	Scope traceql.AttributeScope
	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start time.Time
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End time.Time
}
    TagNamesOptions defines options for [Querier.TagNames].
type TagValuesOptions ¶ added in v0.12.0
type TagValuesOptions struct {
	// AutocompleteQuery is a set of spanset matchers to only return tags seen
	// on matching spansets.
	AutocompleteQuery traceql.Autocomplete
	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start time.Time
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End time.Time
}
    TagValuesOptions defines options for [Querier.TagValues].
type TraceByIDOptions ¶
type TraceByIDOptions struct {
	// Start defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	Start time.Time
	// End defines time range for search.
	//
	// Querier ignores parameter, if it is zero.
	End time.Time
}
    TraceByIDOptions defines options for [Querier.TraceByID] method.