Documentation ¶
Index ¶
Constants ¶
const CurrentEncoding = v2.Encoding
CurrentEncoding is a string representing the encoding that all new blocks should be created with
Variables ¶
AllEncodings is used for testing
var StaticCombiner = objectCombiner{}
Functions ¶
func CombineForRead ¶ added in v1.3.0
CombineForRead is a convenience method used for combining while reading a trace. Due its use of PrepareForRead() it is a costly method and should not be called during any write or compaction operations.
Types ¶
type ObjectCombiner ¶
type ObjectDecoder ¶ added in v1.4.0
type ObjectDecoder interface { // PrepareForRead converts the byte slice into a tempopb.Trace for reading. This can be very expensive // and should only be used when surfacing a byte slice from tempodb and preparing it for reads. PrepareForRead(obj []byte) (*tempopb.Trace, error) // Matches tests the passed byte slice and id to determine if it matches the criteria in tempopb.SearchRequest Matches(id []byte, obj []byte, req *tempopb.SearchRequest) (*tempopb.TraceSearchMetadata, error) // Combine combines the passed byte slice Combine(objs ...[]byte) ([]byte, error) // FastRange returns the start and end unix epoch timestamp of the trace. If its not possible to efficiently get these // values from the underlying encoding then it should return decoder.ErrUnsupported FastRange(obj []byte) (uint32, uint32, error) }
ObjectDecoder is used to work with opaque byte slices that contain trace data in the backend
func MustNewObjectDecoder ¶ added in v1.4.0
func MustNewObjectDecoder(dataEncoding string) ObjectDecoder
MustNewObjectDecoder creates a new encoding or it panics
func NewObjectDecoder ¶ added in v1.4.0
func NewObjectDecoder(dataEncoding string) (ObjectDecoder, error)
NewObjectDecoder returns a Decoder given the passed string.
type SegmentDecoder ¶ added in v1.4.0
type SegmentDecoder interface { // PrepareForWrite takes a trace pointer and returns a record prepared for writing to an ingester PrepareForWrite(trace *tempopb.Trace, start uint32, end uint32) ([]byte, error) // PrepareForRead converts a set of segments created using PrepareForWrite. These segments // are converted into a tempopb.Trace. This operation can be quite costly and should be called only for reading PrepareForRead(segments [][]byte) (*tempopb.Trace, error) // ToObject converts a set of segments into an object ready to be written to the tempodb backend. // The resultant byte slice can then be manipulated using the corresponding ObjectDecoder. // ToObject is on the write path and should do as little as possible. ToObject(segments [][]byte) ([]byte, error) // FastRange returns the start and end unix epoch timestamp of the provided segment. If its not possible to efficiently get these // values from the underlying encoding then it should return decoder.ErrUnsupported FastRange(segment []byte) (uint32, uint32, error) }
SegmentDecoder is used by the distributor/ingester to aggregate and pass segments of traces. The distributor creates the segments using PrepareForWrite which can then be consumed and organized by traceid in the ingester.
The ingester then holds these in memory until either:
- The trace id is queried. In this case it uses PrepareForRead to turn the segments into a tempopb.Trace for return on the query path.
- It needs to push them into tempodb. For this it uses ToObject() to create a single byte slice from the segments that is then completely handled by an ObjectDecoder of the same version
func MustNewSegmentDecoder ¶ added in v1.4.0
func MustNewSegmentDecoder(dataEncoding string) SegmentDecoder
MustNewSegmentDecoder creates a new encoding or it panics
func NewSegmentDecoder ¶ added in v1.4.0
func NewSegmentDecoder(dataEncoding string) (SegmentDecoder, error)
NewSegmentDecoder returns a Decoder given the passed string.