clickhousespanstore

package
v0.0.0-...-798c568 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoding

type Encoding string
const (
	// EncodingJSON is used for spans encoded as JSON.
	EncodingJSON Encoding = "json"
	// EncodingProto is used for spans encoded as Protobuf.
	EncodingProto Encoding = "protobuf"
)

type SpanWriter

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

SpanWriter for writing spans to ClickHouse

func NewSpanWriter

func NewSpanWriter(
	logger hclog.Logger,
	db *sql.DB,
	indexTable,
	spansTable TableName,
	tenant string,
	encoding Encoding,
	delay time.Duration,
	size int64,
	maxSpanCount int,
) *SpanWriter

NewSpanWriter returns a SpanWriter for the database

func (*SpanWriter) Close

func (w *SpanWriter) Close() error

Close Implements io.Closer and closes the underlying storage

func (*SpanWriter) WriteSpan

func (w *SpanWriter) WriteSpan(_ context.Context, span *model.Span) error

WriteSpan writes the encoded span

type TableName

type TableName string

func (TableName) ToLocal

func (tableName TableName) ToLocal() TableName

type TraceReader

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

TraceReader for reading spans from ClickHouse

func NewTraceReader

func NewTraceReader(db *sql.DB, operationsTable, indexTable, spansTable TableName, tenant string, maxNumSpans uint) *TraceReader

NewTraceReader returns a TraceReader for the database

func (*TraceReader) FindTraceIDs

func (r *TraceReader) FindTraceIDs(ctx context.Context, params *spanstore.TraceQueryParameters) ([]model.TraceID, error)

FindTraceIDs retrieves only the TraceIDs that match the traceQuery, but not the trace data

func (*TraceReader) FindTraces

func (r *TraceReader) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error)

FindTraces retrieves traces that match the traceQuery

func (*TraceReader) GetOperations

func (r *TraceReader) GetOperations(
	ctx context.Context,
	params spanstore.OperationQueryParameters,
) ([]spanstore.Operation, error)

GetOperations fetches operations in the service and empty slice if service does not exists

func (*TraceReader) GetServices

func (r *TraceReader) GetServices(ctx context.Context) ([]string, error)

GetServices fetches the sorted service list that have not expired

func (*TraceReader) GetTrace

func (r *TraceReader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error)

GetTrace takes a traceID and returns a Trace associated with that traceID

type WorkerParams

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

WorkerParams contains parameters that are shared between WriteWorkers

type WriteWorker

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

WriteWorker writes spans to CLickHouse. Given a batch of spans, WriteWorker attempts to write them to database. Interval in seconds between attempts changes due to delays slice, then it remains the same as the last value in delays.

func (*WriteWorker) Close

func (worker *WriteWorker) Close()

func (*WriteWorker) Work

func (worker *WriteWorker) Work()

type WriteWorkerPool

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

WriteWorkerPool is a worker pool for writing batches of spans. Given a new batch, WriteWorkerPool creates a new WriteWorker. If the number of currently processed spans if more than maxSpanCount, then the oldest worker is removed.

func NewWorkerPool

func NewWorkerPool(params *WorkerParams, maxSpanCount int) WriteWorkerPool

func (*WriteWorkerPool) Close

func (pool *WriteWorkerPool) Close()

func (*WriteWorkerPool) Work

func (pool *WriteWorkerPool) Work()

func (*WriteWorkerPool) WriteBatch

func (pool *WriteWorkerPool) WriteBatch(batch []*model.Span)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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