executor

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SummaryDimensionsLimit is the maximum number of dimensions to summarize.
	SummaryDimensionsLimit = 15
	// SummaryTimeDimensionsLimit is the maximum number of time dimensions to summarize.
	SummaryTimeDimensionsLimit = 2
	// SummarySampleInterval is the time offset from the max timestamp used for sampling values.
	SummarySampleInterval = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DimensionSummary

type DimensionSummary struct {
	Name         string `json:"name"`
	DataType     string `json:"data_type"`
	ExampleValue any    `json:"example_value,omitempty"`
	HasNulls     bool   `json:"has_nulls,omitempty"`
	MinValue     any    `json:"min_value,omitempty"`
	MaxValue     any    `json:"max_value,omitempty"`
}

DimensionSummary provides statistics for a single dimension in the metrics view.

type Executor

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

Executor is capable of executing queries and other operations against a metrics view.

func New

func New(ctx context.Context, rt *runtime.Runtime, instanceID string, mv *runtimev1.MetricsViewSpec, streaming bool, sec *runtime.ResolvedSecurity, priority int, userAttrs map[string]any) (*Executor, error)

New creates a new Executor for the provided metrics view.

func (*Executor) Annotations

func (e *Executor) Annotations(ctx context.Context, qry *metricsview.AnnotationsQuery) ([]map[string]any, error)

func (*Executor) BindAnnotationsQuery

func (e *Executor) BindAnnotationsQuery(ctx context.Context, qry *metricsview.AnnotationsQuery, timestamps metricsview.TimestampsResult) error

BindAnnotationsQuery allows setting min, max and watermark from a cache for an AnnotationsQuery

func (*Executor) BindQuery

func (e *Executor) BindQuery(ctx context.Context, qry *metricsview.Query, timestamps metricsview.TimestampsResult) error

BindQuery allows to set min, max and watermark from a cache.

func (*Executor) CacheKey

func (e *Executor) CacheKey(ctx context.Context) ([]byte, bool, error)

CacheKey returns a cache key based on the executor's metrics view's cache key configuration. If ok is false, caching is disabled for the metrics view.

func (*Executor) Close

func (e *Executor) Close()

Close releases the resources held by the Executor.

func (*Executor) Export

func (e *Executor) Export(ctx context.Context, qry *metricsview.Query, executionTime *time.Time, format drivers.FileFormat, headers []string) (string, error)

Export executes and exports the provided query against the metrics view. It returns a path to a temporary file containing the export. The caller is responsible for cleaning up the file.

func (*Executor) Query

func (e *Executor) Query(ctx context.Context, qry *metricsview.Query, executionTime *time.Time) (*drivers.Result, error)

Query executes the provided query against the metrics view.

func (*Executor) Schema

func (e *Executor) Schema(ctx context.Context) (*runtimev1.StructType, error)

Schema returns a schema for the metrics view's dimensions and measures.

func (*Executor) Search

func (e *Executor) Search(ctx context.Context, qry *metricsview.SearchQuery, executionTime *time.Time) ([]metricsview.SearchResult, error)

Search executes the provided query against the metrics view.

func (*Executor) Summary

func (e *Executor) Summary(ctx context.Context) (*SummaryResult, error)

Summary provides statistics for all dimensions and measures in the metrics view.

func (*Executor) Timestamps

func (e *Executor) Timestamps(ctx context.Context, timeDim string) (metricsview.TimestampsResult, error)

Timestamps queries min, max and watermark for the metrics view.

func (*Executor) ValidateAndNormalizeMetricsView

func (e *Executor) ValidateAndNormalizeMetricsView(ctx context.Context) (*ValidateMetricsViewResult, error)

ValidateAndNormalizeMetricsView validates the dimensions and measures in the executor's metrics view and returns a ValidateMetricsViewResult It also inherits properties from parent metrics view and populates the schema of the metrics view if all dimensions and measures are valid. Note: Beware that it modifies the e.metricsView spec in place, e.g. to populate the dimension and measure types.

func (*Executor) ValidateQuery

func (e *Executor) ValidateQuery(qry *metricsview.Query) error

ValidateQuery validates the provided query against the executor's metrics view.

type IndexErr

type IndexErr struct {
	Idx int
	Err error
}

IndexErr contains an error and the index of the dimension or measure that caused the error.

type SummaryResult

type SummaryResult struct {
	DefaultTimeDimension DimensionSummary   `json:"default_time_dimension,omitempty"`
	Dimensions           []DimensionSummary `json:"dimensions"`
}

SummaryResult is the statistics for a single metrics view.

type ValidateMetricsViewResult

type ValidateMetricsViewResult struct {
	TimeDimensionErr error
	DimensionErrs    []IndexErr
	MeasureErrs      []IndexErr
	OtherErrs        []error
}

ValidateMetricsViewResult contains the results of validating a metrics view.

func (*ValidateMetricsViewResult) Error

func (r *ValidateMetricsViewResult) Error() error

Error returns a single error containing all validation errors. If there are no errors, it returns nil.

func (*ValidateMetricsViewResult) IsZero

func (r *ValidateMetricsViewResult) IsZero() bool

IsZero returns true if the result contains no errors.

Jump to

Keyboard shortcuts

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