influxdb

package
v2.7.6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadRangePhysKind           = "ReadRangePhysKind"
	ReadGroupPhysKind           = "ReadGroupPhysKind"
	ReadWindowAggregatePhysKind = "ReadWindowAggregatePhysKind"
	ReadTagKeysPhysKind         = "ReadTagKeysPhysKind"
	ReadTagValuesPhysKind       = "ReadTagValuesPhysKind"
)
View Source
const BucketsKind = "influxdata/influxdb.localBuckets"
View Source
const FromKind = "influxDBFrom"

Variables

This section is empty.

Functions

func InjectFlagsFromContext added in v2.2.0

func InjectFlagsFromContext(ctx context.Context) context.Context

InjectFlagsFromContext will take the idpe feature flags from the context and wrap them in a flux feature flagger for the flux engine.

func NewMetrics

func NewMetrics(ctxLabelKeys []string) *metrics

NewMetrics produces a new metrics objects for an influxdb source. Currently it just collects the duration of read requests into a histogram. ctxLabelKeys is a list of labels to add to the produced metrics. The value for a given key will be read off the context. The context value must be a string or an implementation of the Stringer interface. In addition, produced metrics will be labeled with the orgID and type of operation requested.

func ToStoragePredicate

func ToStoragePredicate(n semantic.Expression, objectName string) (*datatypes.Predicate, error)

ToStoragePredicate will convert a FunctionExpression into a predicate that can be sent down to the storage layer.

Types

type AllBucketLookup

type AllBucketLookup interface {
	FindAllBuckets(ctx context.Context, orgID platform2.ID) ([]*platform.Bucket, int)
}

type BucketDependencies

type BucketDependencies AllBucketLookup

type BucketLookup

type BucketLookup interface {
	Lookup(ctx context.Context, orgID platform2.ID, name string) (platform2.ID, bool)
}

type BucketsDecoder

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

func (*BucketsDecoder) Close

func (bd *BucketsDecoder) Close() error

func (*BucketsDecoder) Connect

func (bd *BucketsDecoder) Connect(ctx context.Context) error

func (*BucketsDecoder) Decode

func (bd *BucketsDecoder) Decode(ctx context.Context) (flux.Table, error)

func (*BucketsDecoder) Fetch

func (bd *BucketsDecoder) Fetch(ctx context.Context) (bool, error)

type Config added in v2.0.9

type Config = influxdb.Config

type Dependencies

type Dependencies struct {
	StorageDeps StorageDependencies
	FluxDeps    flux.Dependencies
}

func NewDependencies

func NewDependencies(
	reader query.StorageReader,
	writer storage.PointsWriter,
	bucketSvc influxdb.BucketService,
	orgSvc influxdb.OrganizationService,
	ss influxdb.SecretService,
	metricLabelKeys []string,
	fluxopts ...FluxDepOption,
) (Dependencies, error)

func (Dependencies) Inject

func (d Dependencies) Inject(ctx context.Context) context.Context

func (Dependencies) PrometheusCollectors

func (d Dependencies) PrometheusCollectors() []prometheus.Collector

PrometheusCollectors satisfies the prom.PrometheusCollector interface.

type FluxDepOption added in v2.2.0

type FluxDepOption func(*flux.Deps)

func WithURLValidator added in v2.2.0

func WithURLValidator(v url.Validator) FluxDepOption

type FromDependencies

type FromDependencies struct {
	Reader             query.StorageReader
	BucketLookup       BucketLookup
	OrganizationLookup OrganizationLookup
	Metrics            *metrics
}

func (FromDependencies) PrometheusCollectors

func (d FromDependencies) PrometheusCollectors() []prometheus.Collector

PrometheusCollectors satisfies the PrometheusCollector interface.

func (FromDependencies) Validate

func (d FromDependencies) Validate() error

type FromOpSpec

type FromOpSpec = influxdb.FromOpSpec

type FromStorageProcedureSpec

type FromStorageProcedureSpec struct {
	Bucket influxdb.NameOrID
}

func (*FromStorageProcedureSpec) Copy

func (*FromStorageProcedureSpec) Kind

func (*FromStorageProcedureSpec) PostPhysicalValidate

func (s *FromStorageProcedureSpec) PostPhysicalValidate(id plan.NodeID) error

type FromStorageRule

type FromStorageRule struct{}

func (FromStorageRule) Name

func (rule FromStorageRule) Name() string

func (FromStorageRule) Pattern

func (rule FromStorageRule) Pattern() plan.Pattern

func (FromStorageRule) Rewrite

func (rule FromStorageRule) Rewrite(ctx context.Context, node plan.Node) (plan.Node, bool, error)

type GroupWindowAggregateTransposeRule

type GroupWindowAggregateTransposeRule struct{}

GroupWindowAggregateTransposeRule will match the given pattern. ReadGroupPhys |> window |> { min, max, count, sum }

This pattern will use the PushDownWindowAggregateRule to determine if the ReadWindowAggregatePhys operation is available before it will rewrite the above. This rewrites the above to:

ReadWindowAggregatePhys |> group(columns: ["_start", "_stop", ...]) |> { min, max, sum }

The count aggregate uses sum to merge the results.

func (GroupWindowAggregateTransposeRule) Name

func (GroupWindowAggregateTransposeRule) Pattern

func (GroupWindowAggregateTransposeRule) Rewrite

type HostLookup

type HostLookup interface {
	Hosts() []string
	Watch() <-chan struct{}
}

type LocalBucketsProcedureSpec

type LocalBucketsProcedureSpec struct {
	plan.DefaultCost
}

func (*LocalBucketsProcedureSpec) Copy

func (*LocalBucketsProcedureSpec) Kind

type LocalBucketsRule

type LocalBucketsRule struct{}

func (LocalBucketsRule) Name

func (rule LocalBucketsRule) Name() string

func (LocalBucketsRule) Pattern

func (rule LocalBucketsRule) Pattern() plan.Pattern

func (LocalBucketsRule) Rewrite

func (rule LocalBucketsRule) Rewrite(ctx context.Context, node plan.Node) (plan.Node, bool, error)

type MergeFiltersRule

type MergeFiltersRule struct{}

func (MergeFiltersRule) Name

func (MergeFiltersRule) Name() string

func (MergeFiltersRule) Pattern

func (MergeFiltersRule) Pattern() plan.Pattern

func (MergeFiltersRule) Rewrite

func (r MergeFiltersRule) Rewrite(ctx context.Context, pn plan.Node) (plan.Node, bool, error)

type NameOrID

type NameOrID = influxdb.NameOrID

type OrganizationLookup

type OrganizationLookup interface {
	Lookup(ctx context.Context, name string) (platform2.ID, bool)
}

type Predicate added in v2.0.9

type Predicate = influxdb.Predicate

type PredicateSet added in v2.0.9

type PredicateSet = influxdb.PredicateSet

type Provider added in v2.0.9

type Provider struct {
	influxdb.HttpProvider
	Reader       query.StorageReader
	BucketLookup BucketLookup
}

Provider is an implementation of influxdb.Provider that exposes the query.StorageReader to flux and, if a host or org were specified, it delegates to the influxdb.HttpProvider.

func (Provider) SeriesCardinalityReaderFor added in v2.0.9

func (p Provider) SeriesCardinalityReaderFor(ctx context.Context, conf influxdb.Config, bounds flux.Bounds, predicateSet influxdb.PredicateSet) (influxdb.Reader, error)

func (Provider) WriterFor added in v2.1.0

func (p Provider) WriterFor(ctx context.Context, conf influxdb.Config) (influxdb.Writer, error)

type PushDownAggregateWindowRule added in v2.4.0

type PushDownAggregateWindowRule struct{}

func (PushDownAggregateWindowRule) Name added in v2.4.0

func (PushDownAggregateWindowRule) Pattern added in v2.4.0

func (PushDownAggregateWindowRule) Rewrite added in v2.4.0

type PushDownBareAggregateRule

type PushDownBareAggregateRule struct{}

PushDownBareAggregateRule is a rule that allows pushing down of aggregates that are directly over a ReadRange source.

func (PushDownBareAggregateRule) Name

func (PushDownBareAggregateRule) Pattern

func (PushDownBareAggregateRule) Rewrite

type PushDownFilterRule

type PushDownFilterRule struct{}

PushDownFilterRule is a rule that pushes filters into from procedures to be evaluated in the storage layer. This rule is likely to be replaced by a more generic rule when we have a better framework for pushing filters, etc into sources.

func (PushDownFilterRule) Name

func (PushDownFilterRule) Name() string

func (PushDownFilterRule) Pattern

func (PushDownFilterRule) Pattern() plan.Pattern

func (PushDownFilterRule) Rewrite

func (PushDownFilterRule) Rewrite(ctx context.Context, pn plan.Node) (plan.Node, bool, error)

type PushDownGroupAggregateRule

type PushDownGroupAggregateRule struct{}

Push Down of group aggregates. ReadGroupPhys |> { count }

func (PushDownGroupAggregateRule) Name

func (PushDownGroupAggregateRule) Pattern

func (rule PushDownGroupAggregateRule) Pattern() plan.Pattern

func (PushDownGroupAggregateRule) Rewrite

type PushDownGroupRule

type PushDownGroupRule struct{}

PushDownGroupRule pushes down a group operation to storage

func (PushDownGroupRule) Name

func (rule PushDownGroupRule) Name() string

func (PushDownGroupRule) Pattern

func (rule PushDownGroupRule) Pattern() plan.Pattern

func (PushDownGroupRule) Rewrite

func (rule PushDownGroupRule) Rewrite(ctx context.Context, node plan.Node) (plan.Node, bool, error)

type PushDownRangeRule

type PushDownRangeRule struct{}

PushDownRangeRule pushes down a range filter to storage

func (PushDownRangeRule) Name

func (rule PushDownRangeRule) Name() string

func (PushDownRangeRule) Pattern

func (rule PushDownRangeRule) Pattern() plan.Pattern

Pattern matches 'from |> range'

func (PushDownRangeRule) Rewrite

func (rule PushDownRangeRule) Rewrite(ctx context.Context, node plan.Node) (plan.Node, bool, error)

Rewrite converts 'from |> range' into 'ReadRange'

type PushDownReadTagKeysRule

type PushDownReadTagKeysRule struct{}

PushDownReadTagKeysRule matches 'ReadRange |> keys() |> keep() |> distinct()'. The 'from()' must have already been merged with 'range' and, optionally, may have been merged with 'filter'. If any other properties have been set on the from procedure, this rule will not rewrite anything.

func (PushDownReadTagKeysRule) Name

func (rule PushDownReadTagKeysRule) Name() string

func (PushDownReadTagKeysRule) Pattern

func (rule PushDownReadTagKeysRule) Pattern() plan.Pattern

func (PushDownReadTagKeysRule) Rewrite

func (rule PushDownReadTagKeysRule) Rewrite(ctx context.Context, pn plan.Node) (plan.Node, bool, error)

type PushDownReadTagValuesRule

type PushDownReadTagValuesRule struct{}

PushDownReadTagValuesRule matches 'ReadRange |> keep(columns: [tag]) |> group() |> distinct(column: tag)'. The 'from()' must have already been merged with 'range' and, optionally, may have been merged with 'filter'. If any other properties have been set on the from procedure, this rule will not rewrite anything.

func (PushDownReadTagValuesRule) Name

func (rule PushDownReadTagValuesRule) Name() string

func (PushDownReadTagValuesRule) Pattern

func (rule PushDownReadTagValuesRule) Pattern() plan.Pattern

func (PushDownReadTagValuesRule) Rewrite

func (rule PushDownReadTagValuesRule) Rewrite(ctx context.Context, pn plan.Node) (plan.Node, bool, error)

type PushDownWindowAggregateByTimeRule

type PushDownWindowAggregateByTimeRule struct{}

PushDownWindowAggregateByTimeRule will match the given pattern. ReadWindowAggregatePhys |> duplicate |> window(every: inf)

If this pattern matches and the arguments to duplicate are matching time column names, it will set the time column on the spec.

func (PushDownWindowAggregateByTimeRule) Name

func (PushDownWindowAggregateByTimeRule) Pattern

func (PushDownWindowAggregateByTimeRule) Rewrite

type PushDownWindowAggregateRule

type PushDownWindowAggregateRule struct{}

Push Down of window aggregates. ReadRangePhys |> window |> { min, max, mean, count, sum }

func (PushDownWindowAggregateRule) Name

func (PushDownWindowAggregateRule) Pattern

func (rule PushDownWindowAggregateRule) Pattern() plan.Pattern

func (PushDownWindowAggregateRule) Rewrite

type PushDownWindowForceAggregateRule added in v2.0.7

type PushDownWindowForceAggregateRule struct{}

PushDownWindowForceAggregateRule will match the given pattern. ReadWindowAggregatePhys |> table.fill()

If this pattern matches, then the ForceAggregate switch will be enabled on the ReadWindowAggregate which will force selectors to return a null value.

This pattern is idempotent and may be applied multiple times with the same effect.

func (PushDownWindowForceAggregateRule) Name added in v2.0.7

func (PushDownWindowForceAggregateRule) Pattern added in v2.0.7

func (PushDownWindowForceAggregateRule) Rewrite added in v2.0.7

type ReadGroupPhysSpec

type ReadGroupPhysSpec struct {
	plan.DefaultCost
	ReadRangePhysSpec

	GroupMode flux.GroupMode
	GroupKeys []string

	AggregateMethod string
}

func (*ReadGroupPhysSpec) Copy

func (*ReadGroupPhysSpec) Kind

func (*ReadGroupPhysSpec) PlanDetails

func (s *ReadGroupPhysSpec) PlanDetails() string

type ReadRangePhysSpec

type ReadRangePhysSpec struct {
	plan.DefaultCost

	Bucket   string
	BucketID string

	// Filter is the filter to use when calling into
	// storage. It must be possible to push down this
	// filter.
	Filter *datatypes.Predicate

	Bounds flux.Bounds
}

func (*ReadRangePhysSpec) Copy

func (*ReadRangePhysSpec) Kind

func (*ReadRangePhysSpec) LookupBucketID

func (s *ReadRangePhysSpec) LookupBucketID(ctx context.Context, orgID platform.ID, buckets BucketLookup) (platform.ID, error)

func (*ReadRangePhysSpec) TimeBounds

func (s *ReadRangePhysSpec) TimeBounds(predecessorBounds *plan.Bounds) *plan.Bounds

TimeBounds implements plan.BoundsAwareProcedureSpec.

type ReadTagKeysPhysSpec

type ReadTagKeysPhysSpec struct {
	ReadRangePhysSpec
}

func (*ReadTagKeysPhysSpec) Copy

func (*ReadTagKeysPhysSpec) Kind

type ReadTagValuesPhysSpec

type ReadTagValuesPhysSpec struct {
	ReadRangePhysSpec
	TagKey string
}

func (*ReadTagValuesPhysSpec) Copy

func (*ReadTagValuesPhysSpec) Kind

type ReadWindowAggregatePhysSpec

type ReadWindowAggregatePhysSpec struct {
	plan.DefaultCost
	ReadRangePhysSpec

	WindowEvery flux.Duration
	Offset      flux.Duration
	Aggregates  []plan.ProcedureKind
	CreateEmpty bool
	TimeColumn  string

	// ForceAggregate forces the aggregates to be treated as
	// aggregates even if they are selectors.
	ForceAggregate bool
}

func (*ReadWindowAggregatePhysSpec) Copy

func (*ReadWindowAggregatePhysSpec) Kind

func (*ReadWindowAggregatePhysSpec) PlanDetails

func (s *ReadWindowAggregatePhysSpec) PlanDetails() string

type SortedPivotRule

type SortedPivotRule struct{}

SortedPivotRule is a rule that optimizes a pivot when it is directly after an influxdb from.

func (SortedPivotRule) Name

func (SortedPivotRule) Name() string

func (SortedPivotRule) Pattern

func (SortedPivotRule) Pattern() plan.Pattern

func (SortedPivotRule) Rewrite

func (SortedPivotRule) Rewrite(ctx context.Context, pn plan.Node) (plan.Node, bool, error)

type Source

type Source struct {
	execute.ExecutionNode
	// contains filtered or unexported fields
}

func (*Source) AddTransformation

func (s *Source) AddTransformation(t execute.Transformation)

func (*Source) Metadata

func (s *Source) Metadata() metadata.Metadata

func (*Source) Run

func (s *Source) Run(ctx context.Context)

type StaticLookup

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

func NewStaticLookup

func NewStaticLookup(hosts []string) StaticLookup

func (StaticLookup) Hosts

func (l StaticLookup) Hosts() []string

func (StaticLookup) Watch

func (l StaticLookup) Watch() <-chan struct{}

type StorageDependencies

type StorageDependencies struct {
	FromDeps   FromDependencies
	BucketDeps BucketDependencies
	ToDeps     ToDependencies
}

func GetStorageDependencies

func GetStorageDependencies(ctx context.Context) StorageDependencies

func (StorageDependencies) Inject

func (StorageDependencies) PrometheusCollectors

func (d StorageDependencies) PrometheusCollectors() []prometheus.Collector

PrometheusCollectors satisfies the prom.PrometheusCollector interface.

type ToDependencies

type ToDependencies struct {
	BucketLookup       BucketLookup
	OrganizationLookup OrganizationLookup
	PointsWriter       storage.PointsWriter
}

ToDependencies contains the dependencies for executing the `to` function.

func (ToDependencies) Validate

func (d ToDependencies) Validate() error

Validate returns an error if any required field is unset.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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