Class GetMetricsRequest.Builder

java.lang.Object
com.ants.platform.client.resources.metrics.requests.GetMetricsRequest.Builder
All Implemented Interfaces:
GetMetricsRequest._FinalStage, GetMetricsRequest.QueryStage
Enclosing class:
GetMetricsRequest

public static final class GetMetricsRequest.Builder extends Object implements GetMetricsRequest.QueryStage, GetMetricsRequest._FinalStage
  • Method Details

    • from

      Specified by:
      from in interface GetMetricsRequest.QueryStage
    • query

      public GetMetricsRequest._FinalStage query(@NotNull String query)

      JSON string containing the query parameters with the following structure:

      {
        "view": string,           // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"
        "dimensions": [           // Optional. Default: []
          {
            "field": string       // Field to group by, e.g. "name", "userId", "sessionId"
          }
        ],
        "metrics": [              // Required. At least one metric must be provided
          {
            "measure": string,    // What to measure, e.g. "count", "latency", "value"
            "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
          }
        ],
        "filters": [              // Optional. Default: []
          {
            "column": string,     // Column to filter on
            "operator": string,   // Operator, e.g. "=", ">", "<", "contains"
            "value": any,         // Value to compare against
            "type": string,       // Data type, e.g. "string", "number", "stringObject"
            "key": string         // Required only when filtering on metadata
          }
        ],
        "timeDimension": {        // Optional. Default: null. If provided, results will be grouped by time
          "granularity": string   // One of "minute", "hour", "day", "week", "month", "auto"
        },
        "fromTimestamp": string,  // Required. ISO datetime string for start of time range
        "toTimestamp": string,    // Required. ISO datetime string for end of time range
        "orderBy": [              // Optional. Default: null
          {
            "field": string,      // Field to order by
            "direction": string   // "asc" or "desc"
          }
        ],
        "config": {               // Optional. Query-specific configuration
          "bins": number,         // Optional. Number of bins for histogram (1-100), default: 10
          "row_limit": number     // Optional. Row limit for results (1-1000)
        }
      }
      
      Specified by:
      query in interface GetMetricsRequest.QueryStage
      Returns:
      Reference to this so that method calls can be chained together.
    • build

      public GetMetricsRequest build()
      Specified by:
      build in interface GetMetricsRequest._FinalStage