Documentation
¶
Overview ¶
Package chstorage provides Clickhouse-based storage.
Index ¶
- type Attributes
- type AttributesOption
- type ClickhouseClient
- type ClickhouseOptimizer
- type Column
- type Columns
- type DialOptions
- type InputNode
- type Inserter
- type InserterOptions
- type LogsQuery
- type LogsSelector
- type Querier
- func (q *Querier) Capabilities() (caps logqlengine.QuerierCapabilities)
- func (q *Querier) ExemplarQuerier(ctx context.Context) (storage.ExemplarQuerier, error)
- func (q *Querier) LabelNames(ctx context.Context, opts logstorage.LabelsOptions) (result []string, rerr error)
- func (q *Querier) LabelValues(ctx context.Context, labelName string, opts logstorage.LabelsOptions) (riter iterators.Iterator[logstorage.Label], rerr error)
- func (q *Querier) Querier(mint, maxt int64) (storage.Querier, error)
- func (q *Querier) Query(ctx context.Context, labels []logql.LabelMatcher) (logqlengine.PipelineNode, error)
- func (q *Querier) SearchTags(ctx context.Context, tags map[string]string, ...) (_ iterators.Iterator[tracestorage.Span], rerr error)
- func (q *Querier) SelectSpansets(ctx context.Context, params traceqlengine.SelectSpansetsParams) (_ iterators.Iterator[traceqlengine.Trace], rerr error)
- func (q *Querier) Series(ctx context.Context, opts logstorage.SeriesOptions) (result logstorage.Series, rerr error)
- func (q *Querier) TagNames(ctx context.Context, opts tracestorage.TagNamesOptions) (r []tracestorage.TagName, rerr error)
- func (q *Querier) TagValues(ctx context.Context, tag traceql.Attribute, opts tracestorage.TagValuesOptions) (_ iterators.Iterator[tracestorage.Tag], rerr error)
- func (q *Querier) TraceByID(ctx context.Context, id otelstorage.TraceID, ...) (_ iterators.Iterator[tracestorage.Span], rerr error)
- type QuerierOptions
- type SampleQuery
- type SamplingNode
- type SamplingOp
- type Tables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶ added in v0.5.0
type Attributes struct { Name string Value proto.ColumnOf[otelstorage.Attrs] }
func NewAttributes ¶ added in v0.5.0
func NewAttributes(name string, opts ...AttributesOption) *Attributes
NewAttributes constructs a new Attributes storage representation.
func (*Attributes) Append ¶ added in v0.5.0
func (a *Attributes) Append(kv otelstorage.Attrs)
Append adds a new map of attributes.
func (*Attributes) Columns ¶ added in v0.5.0
func (a *Attributes) Columns() Columns
Columns returns a slice of Columns for this attribute set.
func (*Attributes) DDL ¶ added in v0.16.0
func (a *Attributes) DDL(table *ddl.Table)
DDL applies the schema changes to the table.
func (*Attributes) Row ¶ added in v0.5.0
func (a *Attributes) Row(idx int) otelstorage.Attrs
Row returns a new map of attributes for a given row.
type AttributesOption ¶ added in v0.16.0
type AttributesOption func(*attributesOptions)
func WithLowCardinality ¶ added in v0.16.0
func WithLowCardinality(v bool) AttributesOption
type ClickhouseClient ¶ added in v0.7.0
type ClickhouseClient interface { Do(ctx context.Context, q ch.Query) error Ping(ctx context.Context) error }
func Dial ¶ added in v0.5.0
func Dial(ctx context.Context, dsn string, opts DialOptions) (ClickhouseClient, error)
Dial creates new ClickhouseClient using given DSN.
func NewDialingClickhouseClient ¶ added in v0.7.0
func NewDialingClickhouseClient(options ch.Options) ClickhouseClient
type ClickhouseOptimizer ¶ added in v0.10.0
type ClickhouseOptimizer struct{}
ClickhouseOptimizer replaces LogQL engine execution nodes with optimzied Clickhouse queries.
func (*ClickhouseOptimizer) Name ¶ added in v0.10.0
func (o *ClickhouseOptimizer) Name() string
Name returns optimizer name.
func (*ClickhouseOptimizer) Optimize ¶ added in v0.10.0
func (o *ClickhouseOptimizer) Optimize(ctx context.Context, q logqlengine.Query) (logqlengine.Query, error)
Optimize implements [Optimizer].
type Column ¶ added in v0.5.0
Column is a column with name and data that can be used in INSERT or SELECT query.
type Columns ¶ added in v0.5.0
type Columns []Column
Columns is a set of Columns.
func MergeColumns ¶ added in v0.5.0
MergeColumns merges multiple sets of columns into one.
func (Columns) All ¶ added in v0.5.0
All returns comma-separated column names for using in SELECT query instead of `SELECT *`.
func (Columns) ChsqlResult ¶ added in v0.13.0
func (c Columns) ChsqlResult() []chsql.ResultColumn
ChsqlResult returns columns for using in SELECT query.
type DialOptions ¶ added in v0.5.0
type DialOptions struct { // MeterProvider provides OpenTelemetry meter for pool. MeterProvider metric.MeterProvider // TracerProvider provides OpenTelemetry tracer for pool. TracerProvider trace.TracerProvider // Logger provides logger for pool. Logger *zap.Logger }
DialOptions is Dial function options.
type InputNode ¶ added in v0.10.0
type InputNode struct { Sel LogsSelector // contains filtered or unexported fields }
InputNode rebuilds LogQL pipeline in as Clickhouse query.
func (*InputNode) EvalPipeline ¶ added in v0.10.0
func (n *InputNode) EvalPipeline(ctx context.Context, params logqlengine.EvalParams) (logqlengine.EntryIterator, error)
EvalPipeline implements logqlengine.PipelineNode.
func (*InputNode) Traverse ¶ added in v0.10.0
func (n *InputNode) Traverse(cb logqlengine.NodeVisitor) error
Traverse implements logqlengine.Node.
type Inserter ¶
type Inserter struct {
// contains filtered or unexported fields
}
Inserter implements tracestorage.Inserter using Clickhouse.
func NewInserter ¶
func NewInserter(c ClickhouseClient, opts InserterOptions) (*Inserter, error)
NewInserter creates new Inserter.
func (*Inserter) ConsumeMetrics ¶ added in v0.1.0
ConsumeMetrics inserts given metrics.
func (*Inserter) RecordWriter ¶ added in v0.15.0
func (i *Inserter) RecordWriter(ctx context.Context) (logstorage.RecordWriter, error)
RecordWriter returns a new logstorage.RecordWriter
func (*Inserter) SpanWriter ¶ added in v0.15.0
func (i *Inserter) SpanWriter(ctx context.Context) (tracestorage.SpanWriter, error)
SpanWriter returns a new tracestorage.SpanWriter
type InserterOptions ¶ added in v0.0.8
type InserterOptions struct { // Tables provides table paths to query. Tables Tables // MeterProvider provides OpenTelemetry meter for this querier. MeterProvider metric.MeterProvider // TracerProvider provides OpenTelemetry tracer for this querier. TracerProvider trace.TracerProvider }
InserterOptions is Inserter's options.
type LogsQuery ¶ added in v0.10.0
type LogsQuery[E any] struct { Start, End time.Time Sel LogsSelector Direction logqlengine.Direction Limit int Mapper func(logstorage.Record) (E, error) }
LogsQuery defines a logs query.
type LogsSelector ¶ added in v0.14.0
type LogsSelector struct { Labels []logql.LabelMatcher Line []logql.LineFilter PipelineLabels []logql.LabelPredicate }
LogsSelector defines common parameters for logs selection.
type Querier ¶
type Querier struct {
// contains filtered or unexported fields
}
Querier implements tracestorage.Querier using Clickhouse.
func NewQuerier ¶
func NewQuerier(c ClickhouseClient, opts QuerierOptions) (*Querier, error)
NewQuerier creates new Querier.
func (*Querier) Capabilities ¶ added in v0.1.0
func (q *Querier) Capabilities() (caps logqlengine.QuerierCapabilities)
Capabilities implements logqlengine.Querier.
func (*Querier) ExemplarQuerier ¶ added in v0.2.0
Querier returns a new Querier on the storage.
func (*Querier) LabelNames ¶ added in v0.1.0
func (q *Querier) LabelNames(ctx context.Context, opts logstorage.LabelsOptions) (result []string, rerr error)
LabelNames implements logstorage.Querier.
func (*Querier) LabelValues ¶ added in v0.1.0
func (q *Querier) LabelValues(ctx context.Context, labelName string, opts logstorage.LabelsOptions) (riter iterators.Iterator[logstorage.Label], rerr error)
LabelValues implements logstorage.Querier.
func (*Querier) Query ¶ added in v0.10.0
func (q *Querier) Query(ctx context.Context, labels []logql.LabelMatcher) (logqlengine.PipelineNode, error)
Query creates new InputNode.
func (*Querier) SearchTags ¶
func (q *Querier) SearchTags(ctx context.Context, tags map[string]string, opts tracestorage.SearchTagsOptions) (_ iterators.Iterator[tracestorage.Span], rerr error)
SearchTags performs search by given tags.
func (*Querier) SelectSpansets ¶ added in v0.0.8
func (q *Querier) SelectSpansets(ctx context.Context, params traceqlengine.SelectSpansetsParams) (_ iterators.Iterator[traceqlengine.Trace], rerr error)
SelectSpansets get spansets from storage.
func (*Querier) Series ¶ added in v0.13.0
func (q *Querier) Series(ctx context.Context, opts logstorage.SeriesOptions) (result logstorage.Series, rerr error)
Series returns all available log series.
func (*Querier) TagNames ¶
func (q *Querier) TagNames(ctx context.Context, opts tracestorage.TagNamesOptions) (r []tracestorage.TagName, rerr error)
TagNames returns all available tag names.
func (*Querier) TagValues ¶
func (q *Querier) TagValues(ctx context.Context, tag traceql.Attribute, opts tracestorage.TagValuesOptions) (_ iterators.Iterator[tracestorage.Tag], rerr error)
TagValues returns all available tag values for given tag.
func (*Querier) TraceByID ¶
func (q *Querier) TraceByID(ctx context.Context, id otelstorage.TraceID, opts tracestorage.TraceByIDOptions) (_ iterators.Iterator[tracestorage.Span], rerr error)
TraceByID returns spans of given trace.
type QuerierOptions ¶ added in v0.0.8
type QuerierOptions struct { // Tables provides table paths to query. Tables Tables // LabelLimit defines limit for label lookup in the main table. LabelLimit int // MeterProvider provides OpenTelemetry meter for this querier. MeterProvider metric.MeterProvider // TracerProvider provides OpenTelemetry tracer for this querier. TracerProvider trace.TracerProvider }
QuerierOptions is Querier's options.
type SampleQuery ¶ added in v0.10.0
type SampleQuery struct {
Start, End time.Time
Sel LogsSelector
Sampling SamplingOp
GroupingLabels []logql.Label
}
SampleQuery defines a sample query.
func (*SampleQuery) Execute ¶ added in v0.13.0
func (v *SampleQuery) Execute(ctx context.Context, q *Querier) (_ logqlengine.SampleIterator, rerr error)
Execute executes the query using given querier.
type SamplingNode ¶ added in v0.10.0
type SamplingNode struct { Sel LogsSelector Sampling SamplingOp GroupingLabels []logql.Label // contains filtered or unexported fields }
SamplingNode is a logqlengine.SampleNode, which offloads sampling to Clickhouse
func (*SamplingNode) EvalSample ¶ added in v0.10.0
func (n *SamplingNode) EvalSample(ctx context.Context, params logqlengine.EvalParams) (logqlengine.SampleIterator, error)
EvalSample implements logqlengine.SampleNode.
func (*SamplingNode) Traverse ¶ added in v0.10.0
func (n *SamplingNode) Traverse(cb logqlengine.NodeVisitor) error
Traverse implements logqlengine.Node.
type SamplingOp ¶ added in v0.10.0
type SamplingOp int
SamplingOp defines a sampler operation.
const ( // CountSampling counts lines. CountSampling SamplingOp = iota + 1 // BytesSampling counts line lengths in bytes. BytesSampling )
func (SamplingOp) String ¶ added in v0.10.0
func (s SamplingOp) String() string
String implments fmt.Stringer.
type Tables ¶
type Tables struct { Spans string Tags string Points string ExpHistograms string Exemplars string Labels string Logs string LogAttrs string Migration string TTL time.Duration Cluster string }
Tables define table names.
func DefaultTables ¶ added in v0.1.0
func DefaultTables() Tables
DefaultTables returns default tables.
func (Tables) Create ¶
func (t Tables) Create(ctx context.Context, c ClickhouseClient) error
Create creates tables.
Source Files
¶
- attributes.go
- attributes_json.go
- chstorage.go
- clickhouse.go
- columns.go
- columns_logs.go
- columns_metrics.go
- columns_migration.go
- columns_traces.go
- dial.go
- inserter.go
- inserter_logs.go
- inserter_metrics.go
- inserter_traces.go
- querier.go
- querier_logs.go
- querier_logs_node.go
- querier_logs_optimizer.go
- querier_logs_query.go
- querier_metrics.go
- querier_metrics_exemplars.go
- querier_metrics_hist.go
- querier_metrics_point.go
- querier_metrics_series.go
- querier_traces.go
- schema.go
- schema_metrics.go
- schema_traces.go