Documentation
¶
Index ¶
- Constants
- type DimensionSummary
- type Executor
- func (e *Executor) Annotations(ctx context.Context, qry *metricsview.AnnotationsQuery) ([]map[string]any, error)
- func (e *Executor) BindAnnotationsQuery(ctx context.Context, qry *metricsview.AnnotationsQuery, ...) error
- func (e *Executor) BindQuery(qry *metricsview.Query, timestamps metricsview.TimestampsResult) error
- func (e *Executor) CacheKey(ctx context.Context) ([]byte, bool, error)
- func (e *Executor) Close()
- func (e *Executor) Export(ctx context.Context, qry *metricsview.Query, executionTime *time.Time, ...) (string, error)
- func (e *Executor) LatestQueryTable() string
- func (e *Executor) Query(ctx context.Context, qry *metricsview.Query, executionTime *time.Time) (*drivers.Result, error)
- func (e *Executor) ResolveTimeRange(ctx context.Context, tr *metricsview.TimeRange, tz *time.Location, ...) error
- func (e *Executor) RewriteQueryTimeRanges(ctx context.Context, qry *metricsview.Query, executionTime *time.Time) error
- func (e *Executor) Schema(ctx context.Context) (*runtimev1.StructType, error)
- func (e *Executor) Search(ctx context.Context, qry *metricsview.SearchQuery, executionTime *time.Time) ([]metricsview.SearchResult, error)
- func (e *Executor) Summary(ctx context.Context) (*SummaryResult, error)
- func (e *Executor) Timestamps(ctx context.Context, timeDim string) (metricsview.TimestampsResult, error)
- func (e *Executor) ValidateAndNormalizeMetricsView(ctx context.Context) (*ValidateMetricsViewResult, error)
- func (e *Executor) ValidateQuery(qry *metricsview.Query) error
- type IndexErr
- type SummaryResult
- type ValidateMetricsViewResult
Constants ¶
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(qry *metricsview.Query, timestamps metricsview.TimestampsResult) error
BindQuery allows to set min, max and watermark from a cache.
func (*Executor) CacheKey ¶
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) LatestQueryTable ¶ added in v0.86.1
LatestQueryTable returns the table used by the last Query/Export call. Returns the rollup table if one was selected, otherwise the base metricsview table.
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) ResolveTimeRange ¶ added in v0.83.0
func (e *Executor) ResolveTimeRange(ctx context.Context, tr *metricsview.TimeRange, tz *time.Location, executionTime *time.Time) error
ResolveTimeRange resolves the given time range, ensuring only its Start and End properties are populated.
func (*Executor) RewriteQueryTimeRanges ¶ added in v0.85.1
func (e *Executor) RewriteQueryTimeRanges(ctx context.Context, qry *metricsview.Query, executionTime *time.Time) error
RewriteQueryTimeRanges rewrites the time ranges in the query to fixed start/end timestamps.
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. For the primary time dimension it also resolves rollup table timestamps if rollups are present.
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 ¶
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.
Source Files
¶
- executor.go
- executor_enforce_query_limits.go
- executor_export.go
- executor_pivot.go
- executor_rewrite_approx_comparisons.go
- executor_rewrite_druid_exactify.go
- executor_rewrite_druid_groups.go
- executor_rewrite_enforce_caps.go
- executor_rewrite_limit_pushdown.go
- executor_rewrite_percent_of_totals.go
- executor_rewrite_rollup.go
- executor_rewrite_time.go
- executor_rewrite_two_phase_comparisons.go
- executor_summary.go
- executor_timestamps.go
- executor_validate.go
- executor_wrap_clickhouse_computed_time_dim.go
- rollup_grain.go