dbmodel

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTagFilter = tagFilterImpl{}

DefaultTagFilter returns a filter that retrieves all tags from span.Tags, span.Logs, and span.Process.

View Source
var ErrTraceIDWrongLength = errors.New("TraceID is not a 128bit integer")

ErrTraceIDWrongLength is an error that occurs when cassandra has a TraceID that's not 128 bits long

View Source
var ErrUnknownKeyValueTypeFromCassandra = errors.New("Unknown tag type found in Cassandra")

ErrUnknownKeyValueTypeFromCassandra is an error that occurs when trying to decipher an unknown tag type from the database

Functions

func ToDomain

func ToDomain(dbSpan *Span) (*model.Span, error)

ToDomain converts a database Span to a domain model.Span

Types

type ChainedTagFilter

type ChainedTagFilter []TagFilter

ChainedTagFilter applies multiple tag filters in serial fashion.

func NewChainedTagFilter

func NewChainedTagFilter(filters ...TagFilter) ChainedTagFilter

NewChainedTagFilter creates a TagFilter from the variadic list of passed TagFilter.

func (ChainedTagFilter) FilterLogFields

func (tf ChainedTagFilter) FilterLogFields(logFields model.KeyValues) model.KeyValues

FilterLogFields calls each FilterLogFields

func (ChainedTagFilter) FilterProcessTags

func (tf ChainedTagFilter) FilterProcessTags(processTags model.KeyValues) model.KeyValues

FilterProcessTags calls each FilterProcessTags.

func (ChainedTagFilter) FilterTags

func (tf ChainedTagFilter) FilterTags(tags model.KeyValues) model.KeyValues

FilterTags calls each FilterTags

type KeyValue

type KeyValue struct {
	Key          string  `cql:"key"`
	ValueType    string  `cql:"value_type"`
	ValueString  string  `cql:"value_string"`
	ValueBool    bool    `cql:"value_bool"`
	ValueInt64   int64   `cql:"value_long"`   // using more natural column name for Cassandra
	ValueFloat64 float64 `cql:"value_double"` // using more natural column name for Cassandra
	ValueBinary  []byte  `cql:"value_binary"`
}

KeyValue is the UDT representation of a Jaeger KeyValue.

func (*KeyValue) MarshalUDT

func (t *KeyValue) MarshalUDT(name string, info gocql.TypeInfo) ([]byte, error)

MarshalUDT handles marshalling a Tag.

func (*KeyValue) UnmarshalUDT

func (t *KeyValue) UnmarshalUDT(name string, info gocql.TypeInfo, data []byte) error

UnmarshalUDT handles unmarshalling a Tag.

type Log

type Log struct {
	Timestamp int64      `cql:"ts"`
	Fields    []KeyValue `cql:"fields"`
}

Log is the UDT representation of a Jaeger Log.

func (*Log) MarshalUDT

func (l *Log) MarshalUDT(name string, info gocql.TypeInfo) ([]byte, error)

MarshalUDT handles marshalling a Log.

func (*Log) UnmarshalUDT

func (l *Log) UnmarshalUDT(name string, info gocql.TypeInfo, data []byte) error

UnmarshalUDT handles unmarshalling a Log.

type LogFieldsFilter

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

LogFieldsFilter filters all span.Logs.Fields.

func NewLogFieldsFilter

func NewLogFieldsFilter() *LogFieldsFilter

NewLogFieldsFilter return a filter that filters all span.Logs.Fields.

func (*LogFieldsFilter) FilterLogFields

func (f *LogFieldsFilter) FilterLogFields(logFields model.KeyValues) model.KeyValues

FilterLogFields implements TagFilter#FilterLogFields

func (LogFieldsFilter) FilterProcessTags

func (f LogFieldsFilter) FilterProcessTags(processTags model.KeyValues) model.KeyValues

func (LogFieldsFilter) FilterTags

func (f LogFieldsFilter) FilterTags(tags model.KeyValues) model.KeyValues

type Process

type Process struct {
	ServiceName string     `cql:"service_name"`
	Tags        []KeyValue `cql:"tags"`
}

Process is the UDT representation of a Jaeger Process.

func (*Process) MarshalUDT

func (p *Process) MarshalUDT(name string, info gocql.TypeInfo) ([]byte, error)

MarshalUDT handles marshalling a Process.

func (*Process) UnmarshalUDT

func (p *Process) UnmarshalUDT(name string, info gocql.TypeInfo, data []byte) error

UnmarshalUDT handles unmarshalling a Process.

type Span

type Span struct {
	TraceID       TraceID
	SpanID        int64
	ParentID      int64
	OperationName string
	Flags         int32
	StartTime     int64
	Duration      int64
	Tags          []KeyValue
	Logs          []Log
	Refs          []SpanRef
	Process       Process
	ServiceName   string
	SpanHash      int64
}

Span is the database representation of a span.

func FromDomain

func FromDomain(span *model.Span) *Span

FromDomain converts a domain model.Span to a database Span

type SpanRef

type SpanRef struct {
	RefType string  `cql:"ref_type"`
	TraceID TraceID `cql:"trace_id"`
	SpanID  int64   `cql:"span_id"`
}

SpanRef is the UDT representation of a Jaeger Span Reference.

func (*SpanRef) MarshalUDT

func (s *SpanRef) MarshalUDT(name string, info gocql.TypeInfo) ([]byte, error)

MarshalUDT handles marshalling a SpanRef.

func (*SpanRef) UnmarshalUDT

func (s *SpanRef) UnmarshalUDT(name string, info gocql.TypeInfo, data []byte) error

UnmarshalUDT handles unmarshalling a SpanRef.

type TagFilter

type TagFilter interface {
	FilterProcessTags(processTags model.KeyValues) model.KeyValues
	FilterTags(tags model.KeyValues) model.KeyValues
	FilterLogFields(logFields model.KeyValues) model.KeyValues
}

TagFilter filters out any tags that should not be indexed.

type TagInsertion

type TagInsertion struct {
	ServiceName string
	TagKey      string
	TagValue    string
}

TagInsertion contains the items necessary to insert a tag for a given span

func GetAllUniqueTags

func GetAllUniqueTags(span *model.Span, tagFilter TagFilter) []TagInsertion

GetAllUniqueTags creates a list of all unique tags from a set of filtered tags.

func (TagInsertion) String

func (t TagInsertion) String() string

type TraceID

type TraceID [16]byte

TraceID is a serializable form of model.TraceID

func TraceIDFromDomain

func TraceIDFromDomain(traceID model.TraceID) TraceID

TraceIDFromDomain converts domain TraceID into serializable DB representation.

func (TraceID) MarshalCQL

func (t TraceID) MarshalCQL(info gocql.TypeInfo) ([]byte, error)

MarshalCQL handles marshaling DBTraceID (e.g. in SpanRef)

func (TraceID) String

func (dbTraceID TraceID) String() string

String returns hex string representation of the trace ID.

func (TraceID) ToDomain

func (dbTraceID TraceID) ToDomain() model.TraceID

ToDomain converts trace ID from db-serializable form to domain TradeID

func (*TraceID) UnmarshalCQL

func (t *TraceID) UnmarshalCQL(info gocql.TypeInfo, data []byte) error

UnmarshalCQL handles unmarshaling DBTraceID (e.g. in SpanRef)

type UniqueTraceIDs

type UniqueTraceIDs map[TraceID]struct{}

UniqueTraceIDs is a set of unique dbmodel TraceIDs, implemented via map.

func IntersectTraceIDs

func IntersectTraceIDs(uniqueTraceIdsList []UniqueTraceIDs) UniqueTraceIDs

IntersectTraceIDs takes a list of UniqueTraceIDs and intersects them.

func UniqueTraceIDsFromList

func UniqueTraceIDsFromList(traceIDs []TraceID) UniqueTraceIDs

UniqueTraceIDsFromList Takes a list of traceIDs and returns the unique set

func (UniqueTraceIDs) Add

func (u UniqueTraceIDs) Add(traceID TraceID)

Add adds a traceID to the existing map

Jump to

Keyboard shortcuts

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