Record Class DatadogCompute

java.lang.Object
java.lang.Record
codes.grow.packages.datadoglogs.DatadogCompute
Record Components:
aggregation - count, cardinality, pc75 … pc99, sum, min, max, avg or median
type - total (default) or timeseries
interval - time bucket for timeseries, e.g. 5m
metric - measure for non-count aggregations, e.g. @duration

public record DatadogCompute(String aggregation, String type, Optional<String> interval, Optional<String> metric) extends Record
One computation of DatadogLogsQuery.aggregateLogs(java.util.List<codes.grow.packages.datadoglogs.DatadogCompute>, java.util.List<codes.grow.packages.datadoglogs.DatadogGroupBy>, codes.grow.packages.datadoglogs.AggregateLogsOptions); results are keyed c0, c1, … in order.

 DatadogCompute.of("count");
 DatadogCompute.of("avg").withMetric("@duration");
 DatadogCompute.of("count").timeseries("5m");
 
  • Constructor Details

    • DatadogCompute

      public DatadogCompute(String aggregation, String type, Optional<String> interval, Optional<String> metric)
      Creates a compute.
      Parameters:
      aggregation - aggregation function (required)
      type - total or timeseries; null means total
      interval - bucket interval
      metric - measure
      Throws:
      ValidationException - when the aggregation is blank
  • Method Details

    • of

      public static DatadogCompute of(String aggregation)
      A total compute.
      Parameters:
      aggregation - aggregation function
      Returns:
      the compute
    • timeseries

      public DatadogCompute timeseries(String interval)
      Returns a copy as a timeseries with the given bucket interval.
      Parameters:
      interval - bucket interval, e.g. 5m
      Returns:
      the compute
    • withMetric

      public DatadogCompute withMetric(String metric)
      Returns a copy with a measure.
      Parameters:
      metric - measure, e.g. @duration
      Returns:
      the compute
    • toWire

      public Map<String,Object> toWire()
      Returns the wire form.
      Returns:
      a new map
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • aggregation

      public String aggregation()
      Returns the value of the aggregation record component.
      Returns:
      the value of the aggregation record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • interval

      public Optional<String> interval()
      Returns the value of the interval record component.
      Returns:
      the value of the interval record component
    • metric

      public Optional<String> metric()
      Returns the value of the metric record component.
      Returns:
      the value of the metric record component