Method: queryMetrics.fetchTimeSeries

Full name: projects.locations.instances.queryMetrics.fetchTimeSeries

Fetches aggregated time series data derived from QueryMetrics. This is a custom method (AIP-136) designed for generating data for trend charts. Instead of returning individual QueryMetric resources, it returns time-bucketed data points (TimeSeriesDataPoint) with calculated aggregations (e.g., average latency, p95, failure counts) based on the requested view and time range.

HTTP request

GET https://{endpoint}/v1alpha/{parent}/queryMetrics:fetchTimeSeries

Where {endpoint} is one of the supported service endpoints.

Path parameters

Parameters
parent

string

Required. The parent instance resource name. Format: projects/{project}/locations/{location}/instances/{instance}

Query parameters

Parameters
timeRange

object (Interval)

Required. Time range for the time series.

view

enum (TimeSeriesView)

Optional. Specifies which metrics to return in the time series. If unspecified, defaults to LATENCY.

filter

string

Optional. A filter expression that filters query metrics included in the time series. Supports equality filtering by searchMetrics.query_source with string values only.

Allowed values for searchMetrics.query_source: - "QUERY_SOURCE_UI" - "QUERY_SOURCE_API" - "QUERY_SOURCE_SEARCH_LRO_API" - "QUERY_SOURCE_BACKSTORY_API" - "QUERY_SOURCE_ALL_APIS"

Multiple query sources can be combined by OR to include queries matching any of the specified sources.

Example: "searchMetrics.query_source = 'QUERY_SOURCE_BACKSTORY_API' OR searchMetrics.query_source = 'QUERY_SOURCE_SEARCH_LRO_API'"

Request body

The request body must be empty.

Response body

Response message for queryMetrics.fetchTimeSeries.

If successful, the response body contains data with the following structure:

JSON representation
{
  "dataPoints": [
    {
      object (TimeSeriesDataPoint)
    }
  ]
}
Fields
dataPoints[]

object (TimeSeriesDataPoint)

Aggregated query metric data points. Note that the aggregations will be done over 1 day intervals.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/chronicle
  • https://www.googleapis.com/auth/chronicle.readonly

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • chronicle.queryMetrics.list

For more information, see the IAM documentation.

TimeSeriesView

Views to apply to the query time series metrics.

Enums
TIME_SERIES_VIEW_UNSPECIFIED Defaults to LATENCY view if unspecified.
LATENCY Returns both average and P95 latency metrics.
FAILURE Returns only failure metrics.
LATENCY_AVG Returns only average latency metrics.
LATENCY_P95 Returns only P95 latency metrics.

TimeSeriesDataPoint

Represents a single data point in the time series.

JSON representation
{
  "bucketStartTime": string,
  "querySource": enum (QuerySource),
  "timeRangeBucket": enum (QueryTimeRangeBucket),
  "querySources": [
    enum (QuerySource)
  ],

  // Union field metrics can be only one of the following:
  "latencyMetrics": {
    object (LatencyMetrics)
  },
  "failureMetrics": {
    object (FailureMetrics)
  }
  // End of list of possible types for union field metrics.
}
Fields
bucketStartTime

string (Timestamp format)

The start time of the bucket.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

querySource

enum (QuerySource)

The source of the queries for this data point.

timeRangeBucket

enum (QueryTimeRangeBucket)

The scan time range bucket of the queries for this data point.

querySources[]

enum (QuerySource)

The sources of the queries for this data point.

Union field metrics. The metrics payload. The type of metric returned matches the requested view. metrics can be only one of the following:
latencyMetrics

object (LatencyMetrics)

Aggregated latency metrics for successful queries in this bucket.

failureMetrics

object (FailureMetrics)

Aggregated failure rate metrics for queries in this bucket.

LatencyMetrics

Aggregated latency metrics.

JSON representation
{
  "avgLatencyMs": number,
  "p95LatencyMs": number
}
Fields
avgLatencyMs

number

Average latency in milliseconds.

p95LatencyMs

number

P95 latency in milliseconds.

FailureMetrics

Aggregated failure metrics.

JSON representation
{
  "failureCount": string,
  "totalCount": string,
  "failureRate": number
}
Fields
failureCount

string (int64 format)

Number of failed queries.

totalCount

string (int64 format)

Total number of queries.

failureRate

number

Failure rate (failureCount / totalCount).