vparquet

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchPrevious = -1
	SearchNext     = -2
	NotFound       = -3

	TraceIDColumnName = "TraceID"
)
View Source
const (
	LabelName = "name"

	StatusCodeTag   = "status.code"
	StatusCodeUnset = "unset"
	StatusCodeOK    = "ok"
	StatusCodeError = "error"
)

These are reserved search parameters

View Source
const (
	LabelRootSpanName    = "root.name"
	LabelRootServiceName = "root.service.name"

	LabelServiceName = "service.name"
	LabelCluster     = "cluster"
	LabelNamespace   = "namespace"
	LabelPod         = "pod"
	LabelContainer   = "container"

	LabelK8sClusterName   = "k8s.cluster.name"
	LabelK8sNamespaceName = "k8s.namespace.name"
	LabelK8sPodName       = "k8s.pod.name"
	LabelK8sContainerName = "k8s.container.name"

	LabelHTTPMethod     = "http.method"
	LabelHTTPUrl        = "http.url"
	LabelHTTPStatusCode = "http.status_code"
)
View Source
const (
	DataFileName = "data.parquet"
)
View Source
const DefinitionLevelResourceAttrs = 2
View Source
const DefinitionLevelResourceSpans = 1
View Source
const DefinitionLevelResourceSpansILSSpan = 3
View Source
const DefinitionLevelTrace = 0
View Source
const VersionString = "vParquet"

Variables

Functions

func CopyBlock

func CopyBlock(ctx context.Context, meta *backend.BlockMeta, from backend.Reader, to backend.Writer) error

func SortTrace

func SortTrace(t *Trace)

SortTrace sorts a parquet *Trace

Types

type Attribute

type Attribute struct {
	Key string `parquet:",snappy,dict"`

	// This is a bad design that leads to millions of null values. How can we fix this?
	Value       *string  `parquet:",dict,snappy,optional"`
	ValueInt    *int64   `parquet:",snappy,optional"`
	ValueDouble *float64 `parquet:",snappy,optional"`
	ValueBool   *bool    `parquet:",snappy,optional"`
	ValueKVList string   `parquet:",snappy,optional"`
	ValueArray  string   `parquet:",snappy,optional"`
}

type BackendReaderAt

type BackendReaderAt struct {
	TotalBytesRead uint64
	// contains filtered or unexported fields
}

func NewBackendReaderAt

func NewBackendReaderAt(ctx context.Context, r backend.Reader, name string, blockID uuid.UUID, tenantID string) *BackendReaderAt

func (*BackendReaderAt) ReadAt

func (b *BackendReaderAt) ReadAt(p []byte, off int64) (int, error)

func (*BackendReaderAt) ReadAtWithCache

func (b *BackendReaderAt) ReadAtWithCache(p []byte, off int64) (int, error)

type Combiner

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

Combiner combines multiple partial traces into one, deduping spans based on ID and kind. Note that it is destructive. There are design decisions for efficiency: * Only scan/hash the spans for each input once, which is reused across calls. * Only sort the final result once and if needed. * Don't scan/hash the spans for the last input (final=true).

func NewCombiner

func NewCombiner() *Combiner

func (*Combiner) Consume

func (c *Combiner) Consume(tr *Trace) (spanCount int)

Consume the given trace and destructively combines its contents.

func (*Combiner) ConsumeWithFinal

func (c *Combiner) ConsumeWithFinal(tr *Trace, final bool) (spanCount int)

ConsumeWithFinal consumes the trace, but allows for performance savings when it is known that this is the last expected input trace.

func (*Combiner) Result

func (c *Combiner) Result() (*Trace, int)

Result returns the final trace and span count.

type Compactor

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

func NewCompactor

func NewCompactor(opts common.CompactionOptions) *Compactor

func (*Compactor) Compact

func (c *Compactor) Compact(ctx context.Context, l log.Logger, r backend.Reader, writerCallback func(*backend.BlockMeta, time.Time) backend.Writer, inputs []*backend.BlockMeta) (newCompactedBlocks []*backend.BlockMeta, err error)

type Encoding

type Encoding struct{}

func (Encoding) CopyBlock

func (v Encoding) CopyBlock(ctx context.Context, meta *backend.BlockMeta, from backend.Reader, to backend.Writer) error

func (Encoding) NewCompactor

func (v Encoding) NewCompactor(opts common.CompactionOptions) common.Compactor

func (Encoding) OpenBlock

func (v Encoding) OpenBlock(meta *backend.BlockMeta, r backend.Reader) (common.BackendBlock, error)

func (Encoding) Version

func (v Encoding) Version() string

type Event

type Event struct {
	TimeUnixNano           uint64           `parquet:",delta"`
	Name                   string           `parquet:",snappy"`
	Attrs                  []EventAttribute `parquet:""`
	DroppedAttributesCount int32            `parquet:",snappy,delta"`
	Test                   string           `parquet:",snappy,dict,optional"` // Always empty for testing
}

type EventAttribute

type EventAttribute struct {
	Key   string `parquet:",snappy,dict"`
	Value []byte `parquet:",snappy"` // Was json-encoded data, is now proto encoded data
}

type IL

type IL struct {
	Name    string `parquet:",snappy,dict"`
	Version string `parquet:",snappy,dict"`
}

type ILS

type ILS struct {
	InstrumentationLibrary IL     `parquet:"il"`
	Spans                  []Span `parquet:""`
}

type Iterator

type Iterator interface {
	Next(context.Context) (*Trace, error)
	Close()
}

type MultiBlockIterator

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

func (*MultiBlockIterator) Close

func (m *MultiBlockIterator) Close()

func (*MultiBlockIterator) Next

func (m *MultiBlockIterator) Next(ctx context.Context) (common.ID, parquet.Row, error)

type RawIterator

type RawIterator interface {
	Next(context.Context) (common.ID, parquet.Row, error)
	Close()
}

type Resource

type Resource struct {
	Attrs []Attribute

	// Known attributes
	ServiceName      string  `parquet:",snappy,dict"`
	Cluster          *string `parquet:",snappy,optional,dict"`
	Namespace        *string `parquet:",snappy,optional,dict"`
	Pod              *string `parquet:",snappy,optional,dict"`
	Container        *string `parquet:",snappy,optional,dict"`
	K8sClusterName   *string `parquet:",snappy,optional,dict"`
	K8sNamespaceName *string `parquet:",snappy,optional,dict"`
	K8sPodName       *string `parquet:",snappy,optional,dict"`
	K8sContainerName *string `parquet:",snappy,optional,dict"`

	Test string `parquet:",snappy,dict,optional"` // Always empty for testing
}

type ResourceSpans

type ResourceSpans struct {
	Resource                    Resource `parquet:""`
	InstrumentationLibrarySpans []ILS    `parquet:"ils"`
}

type RowTracker

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

type Span

type Span struct {
	// ID is []byte to save space. It doesn't need to be user
	// friendly like trace ID, and []byte is half the size of string.
	ID                     []byte      `parquet:","`
	Name                   string      `parquet:",snappy,dict"`
	Kind                   int         `parquet:",delta"`
	ParentSpanID           []byte      `parquet:","`
	TraceState             string      `parquet:",snappy"`
	StartUnixNanos         uint64      `parquet:",delta"`
	EndUnixNanos           uint64      `parquet:",delta"`
	StatusCode             int         `parquet:",delta"`
	StatusMessage          string      `parquet:",snappy"`
	Attrs                  []Attribute `parquet:""`
	DroppedAttributesCount int32       `parquet:",snappy"`
	Events                 []Event     `parquet:""`
	DroppedEventsCount     int32       `parquet:",snappy"`

	// Known attributes
	HttpMethod     *string `parquet:",snappy,optional,dict"`
	HttpUrl        *string `parquet:",snappy,optional,dict"`
	HttpStatusCode *int64  `parquet:",snappy,optional"`
}

nolint:revive Ignore field naming warnings

type Trace

type Trace struct {
	// TraceID is a byte slice as it helps maintain the sort order of traces within a parquet file
	TraceID       []byte          `parquet:""`
	ResourceSpans []ResourceSpans `parquet:"rs"`

	// TraceIDText is for better useability on downstream systems i.e: something other than Tempo is reading these files.
	// It will not be used as the primary traceID field within Tempo and is only helpful for debugging purposes.
	TraceIDText string `parquet:",snappy"`

	// Trace-level attributes for searching
	StartTimeUnixNano uint64 `parquet:",delta"`
	EndTimeUnixNano   uint64 `parquet:",delta"`
	DurationNanos     uint64 `parquet:",delta"`
	RootServiceName   string `parquet:",dict"`
	RootSpanName      string `parquet:",dict"`
}

func CombineTraces

func CombineTraces(traces ...*Trace) *Trace

Jump to

Keyboard shortcuts

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