Documentation
¶
Index ¶
- func FindPosition(expr string, within posrange.PositionRange, fn string) posrange.PositionRange
- func GetQueryFragment(expr string, pos posrange.PositionRange) string
- func HasVectorSelector(node *parser.PromQLNode) (vs []promParser.VectorSelector)
- func MostOuterOperation[T promParser.Node](s Source) (T, bool)
- func RemoveConditions(source string) promParser.Node
- type DeadInfo
- type Join
- type LabelPromiseType
- type LabelTransform
- type ReturnInfo
- type Source
- type SourceOperation
- type SourceOperations
- type SourceType
- type Visitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPosition ¶ added in v0.71.0
func FindPosition(expr string, within posrange.PositionRange, fn string) posrange.PositionRange
FIXME sum() on ().
func GetQueryFragment ¶ added in v0.71.0
func GetQueryFragment(expr string, pos posrange.PositionRange) string
func HasVectorSelector ¶ added in v0.4.1
func HasVectorSelector(node *parser.PromQLNode) (vs []promParser.VectorSelector)
func MostOuterOperation ¶ added in v0.74.0
func MostOuterOperation[T promParser.Node](s Source) (T, bool)
func RemoveConditions ¶ added in v0.10.1
func RemoveConditions(source string) promParser.Node
RemoveConditions takes a *valid* PromQL expression and removes any condition from it.
Types ¶
type DeadInfo ¶ added in v0.74.0
type DeadInfo struct {
Reason string
Fragment posrange.PositionRange
}
type LabelPromiseType ¶ added in v0.74.0
type LabelPromiseType uint8
const ( ImpossibleLabel LabelPromiseType = iota PossibleLabel GuaranteedLabel )
func (LabelPromiseType) MarshalYAML ¶ added in v0.74.0
func (lpt LabelPromiseType) MarshalYAML() (any, error)
Used for test snapshots.
type LabelTransform ¶ added in v0.74.0
type LabelTransform struct {
Reason string
Kind LabelPromiseType
Fragment posrange.PositionRange
}
type ReturnInfo ¶ added in v0.74.0
type ReturnInfo struct {
LogicalExpr string
ValuePosition posrange.PositionRange
ReturnedNumber float64 // If AlwaysReturns=true this is the number that's returned
AlwaysReturns bool // True if this source always returns results.
KnownReturn bool // True if we always know the return value.
IsReturnBool bool // True if this source uses the 'bool' modifier.
}
type Source ¶ added in v0.67.0
type Source struct {
Labels map[string]LabelTransform
DeadInfo *DeadInfo
Returns promParser.ValueType
Operations SourceOperations
Joins []Join // Any other sources this source joins with.
Unless []Source // Any other sources this source is suppressed by.
ReturnInfo ReturnInfo
Position posrange.PositionRange
Type SourceType
FixedLabels bool // Labels are fixed and only allowed labels can be present.
IsConditional bool // True if this source is guarded by 'foo > 5' or other condition.
}
func LabelsSource ¶ added in v0.67.0
func LabelsSource(expr string, node promParser.Node) (src []Source)
func (Source) CanHaveLabel ¶ added in v0.71.0
func (Source) LabelExcludeReason ¶ added in v0.71.0
func (s Source) LabelExcludeReason(name string) (string, posrange.PositionRange)
func (Source) TransformedLabels ¶ added in v0.74.0
func (s Source) TransformedLabels(kinds ...LabelPromiseType) []string
func (Source) WalkSources ¶ added in v0.71.0
type SourceOperation ¶ added in v0.74.0
type SourceOperation struct {
Node promParser.Node
Operation string
}
func (SourceOperation) MarshalYAML ¶ added in v0.74.0
func (so SourceOperation) MarshalYAML() (any, error)
Used for test snapshots.
type SourceOperations ¶ added in v0.74.0
type SourceOperations []SourceOperation
type SourceType ¶ added in v0.67.0
type SourceType uint8
const ( UnknownSource SourceType = iota NumberSource StringSource SelectorSource FuncSource AggregateSource )
func (SourceType) MarshalYAML ¶ added in v0.74.0
func (st SourceType) MarshalYAML() (any, error)
Used for test snapshots.
Click to show internal directories.
Click to hide internal directories.