Record Class AggregateQuery

java.lang.Object
java.lang.Record
codes.grow.packages.signoz.AggregateQuery
Record Components:
signal - logs or traces
filter - SigNoz filter expression ("" = all)
aggregations - values to compute (at least one)
groupBy - field names to group by
start - window start (null = one hour before the end)
end - window end (null = now)
stepInterval - bucket size of a time series (null or zero = scalar, one row per group); rounded down to whole seconds (at least 1 s)
limit - maximum number of groups (0 = default 100)
orderKey - group field or aggregation alias to order groups by (null = server order)
orderDirection - direction of orderKey (null = descending)

public record AggregateQuery(Signal signal, String filter, List<Aggregation> aggregations, List<String> groupBy, Instant start, Instant end, Duration stepInterval, int limit, String orderKey, SortOrder orderDirection) extends Record
A count/percentile query for SignozQueryClient.aggregate(AggregateQuery). Build it with builder(Signal):

 AggregateQuery q = AggregateQuery.builder(Signal.TRACES)
     .filter("service.name = 'checkout'")
     .count("calls")
     .percentile(99, "duration_nano", "p99")
     .groupBy("name")
     .build();
 
  • Constructor Details

    • AggregateQuery

      public AggregateQuery(Signal signal, String filter, List<Aggregation> aggregations, List<String> groupBy, Instant start, Instant end, Duration stepInterval, int limit, String orderKey, SortOrder orderDirection)
      Copies the lists and fills null values.
      Parameters:
      signal - signal
      filter - filter
      aggregations - aggregations
      groupBy - group fields
      start - start
      end - end
      stepInterval - step
      limit - limit
      orderKey - order key
      orderDirection - order direction
  • Method Details

    • builder

      public static AggregateBuilder builder(Signal signal)
      Starts a builder over a signal.
      Parameters:
      signal - logs or traces
      Returns:
      a new builder (its run() needs a client: use SignozQueryClient.aggregate(Signal) for that)
    • isTimeSeries

      public boolean isTimeSeries()
      Whether this is a time-series query.
      Returns:
      true when a positive step is set
    • startOptional

      public Optional<Instant> startOptional()
      Window start.
      Returns:
      the start, if set
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • signal

      public Signal signal()
      Returns the value of the signal record component.
      Returns:
      the value of the signal record component
    • filter

      public String filter()
      Returns the value of the filter record component.
      Returns:
      the value of the filter record component
    • aggregations

      public List<Aggregation> aggregations()
      Returns the value of the aggregations record component.
      Returns:
      the value of the aggregations record component
    • groupBy

      public List<String> groupBy()
      Returns the value of the groupBy record component.
      Returns:
      the value of the groupBy record component
    • start

      public Instant start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public Instant end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component
    • stepInterval

      public Duration stepInterval()
      Returns the value of the stepInterval record component.
      Returns:
      the value of the stepInterval record component
    • limit

      public int limit()
      Returns the value of the limit record component.
      Returns:
      the value of the limit record component
    • orderKey

      public String orderKey()
      Returns the value of the orderKey record component.
      Returns:
      the value of the orderKey record component
    • orderDirection

      public SortOrder orderDirection()
      Returns the value of the orderDirection record component.
      Returns:
      the value of the orderDirection record component