All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable, PromqlPlan

public final class InstantSelector extends Selector
Represents a PromQL instant vector selector.

An instant vector selects time series based on metric name and label matchers, returning the most recent sample at the evaluation timestamp. This corresponds to PromQL syntax:

 metric_name{label="value"} offset 5m @ timestamp
 
Examples:
 http_requests_total
 cpu_usage{host="web-1"}
 memory_used{env=~"prod.*"} offset 10m
 up{job="prometheus"} @ 1609746000
 
The instant vector selects a single sample per matching time series at the evaluation time (with optional offset/@ modifiers), representing the current state.

Conceptually an instant selector is a range selector with a null range.

  • Constructor Details

  • Method Details

    • info

      protected NodeInfo<InstantSelector> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods to implement this.

      For QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<LogicalPlan>
    • replaceChild

      public InstantSelector replaceChild(LogicalPlan newChild)
      Specified by:
      replaceChild in class UnaryPlan
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Selector
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Selector
    • output

      public List<Attribute> output()
      Description copied from class: QueryPlan
      The ordered list of attributes (i.e. columns) this plan produces when executed. Must be called only on resolved plans, otherwise may throw an exception or return wrong results.
      Specified by:
      output in interface PromqlPlan
      Overrides:
      output in class UnaryPlan
    • returnType

      public PromqlDataType returnType()
      Description copied from interface: PromqlPlan
      The PromQL return type of this plan node.