Method: projects.locations.requirements.checkRequirement

Check a particular requirement.

HTTP request

POST https://discoveryengine.googleapis.com/v1alpha/{location=projects/*/locations/*}/requirements:checkRequirement

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
location

string

Required. Full resource name of the location. Format projects/{project_number_or_id}/locations/{location}

Request body

The request body contains data with the following structure:

JSON representation
{
  "requirementType": string,
  "resources": [
    {
      object (MonitoredResource)
    }
  ]
}
Fields
requirementType

string

The type specifying the requirement to check. The supported types are:

  • discoveryengine.googleapis.com/media_recs/general/all/warning
  • discoveryengine.googleapis.com/media_recs/oyml/cvr/warning
  • discoveryengine.googleapis.com/media_recs/rfy/cvr/warning
  • discoveryengine.googleapis.com/media_recs/mlt/cvr/warning
  • discoveryengine.googleapis.com/media_recs/mp/cvr/warning
  • discoveryengine.googleapis.com/media_recs/oyml/wdps/warning
  • discoveryengine.googleapis.com/media_recs/rfy/wdps/warning
  • discoveryengine.googleapis.com/media_recs/mlt/wdps/warning
resources[]

object (MonitoredResource)

The resources to be checked for this requirement. The type needed for the monitored resources:

  • discoveryengine.googleapis.com/Branch.

    • The labels needed for this resource:
      • project_number
      • location_id
      • collection_id
      • datastore_id
      • branch_id
  • discoveryengine.googleapis.com/DataStore

    • The labels needed for this resource:
      • project_number
      • location_id
      • collection_id
      • datastore_id

Response body

Response for the requirements.checkRequirement method.

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

JSON representation
{
  "requirement": {
    object (Requirement)
  },
  "requirementCondition": {
    object (Expr)
  },
  "metricResults": [
    {
      object (MetricQueryResult)
    }
  ],
  "oldestMetricTimestamp": string,
  "result": string
}
Fields
requirement

object (Requirement)

Requirement definition.

requirementCondition

object (Expr)

The condition for evaluating the requirement result.

metricResults[]

object (MetricQueryResult)

Metric results.

oldestMetricTimestamp

string (Timestamp format)

Timestamp of the oldest calculated metric (i.e. the most stale metric). Indicates that the result may not accurately reflect any Event and Product Catalog updates performed after this time.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

result

string

The result of the requirement. It should be one of the severity fields in the requirement definition. If any error happens during the evaluation, it will be UNKNOWN.

Authorization scopes

Requires the following OAuth scope:

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

For more information, see the Authentication Overview.

Requirement

A data requirement.

JSON representation
{
  "type": string,
  "displayName": string,
  "description": string,
  "condition": {
    object (Expr)
  },
  "metricBindings": [
    {
      object (MetricBinding)
    }
  ],
  "thresholdBindings": [
    {
      object (ThresholdBinding)
    }
  ],
  "violationSamplesBindings": [
    {
      object (ViolationSamplesBinding)
    }
  ],
  "severity": [
    string
  ]
}
Fields
type

string

The requirement type, used as an identifier. Must be unique.

The type should prefix with service name to avoid possible collision. It's encouraged to use natural hierarchical grouping for similar requirements.

Examples:

  • library.googleapis.com/books/min_available_books
  • discoveryengine.googleapis.com/media_rec/recommended_for_you/conversion_rate
displayName

string

The name of the requirement.

description

string

The description of the requirement.

condition

object (Expr)

The condition for evaluating the requirement result.

Variables in the expression should be provided by metrics_bindings or thresholdBindings. Where metrics_bindings are used for computed metrics and thresholdBindings are used to define thresholds for corresponding metricBindings.

metricBindings[]

object (MetricBinding)

A list of the metric bindings to be used in condition.

thresholdBindings[]

object (ThresholdBinding)

A list of threshold bindings to be used in condition.

violationSamplesBindings[]

object (ViolationSamplesBinding)

A list of the metric bindings to be used in condition.

severity[]

string

The severity of errors if the requirement is not met. It must be ordered from the most strict to the least strict. Examples:

  • BLOCKING
  • CRITICAL
  • WARNING

All thresholds in the requirement must have all the severity here.

Expr

Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec.

Example (Comparison):

title: "Summary size limit"
description: "Determines if a summary is less than 100 chars"
expression: "document.summary.size() < 100"

Example (Equality):

title: "Requestor is owner"
description: "Determines if requestor is the document owner"
expression: "document.owner == request.auth.claims.email"

Example (Logic):

title: "Public documents"
description: "Determine whether the document should be publicly visible"
expression: "document.type != 'private' && document.type != 'internal'"

Example (Data Manipulation):

title: "Notification string"
description: "Create a notification string with a timestamp."
expression: "'New message received at ' + string(document.create_time)"

The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.

JSON representation
{
  "expression": string,
  "title": string,
  "description": string,
  "location": string
}
Fields
expression

string

Textual representation of an expression in Common Expression Language syntax.

title

string

Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression.

description

string

Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.

location

string

Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.

MetricBinding

Specifies a metrics query and bind its result to a variable which will be used in the condition.

JSON representation
{
  "variableId": string,
  "resourceType": string,
  "metricFilter": string,
  "description": string,
  "category": string
}
Fields
variableId

string

The variable id to be referenced in condition.

resourceType

string

The resource being monitored for the metric.

metricFilter

string

The filter string used for metrics query.

Example:

"metric.type = "discoveryengine.googleapis.com/events/day_count" AND " "metric.conditions.time_range = "NINETY_DAYS""

description

string

Human readable description of the corresponding metric filter.

category

string

The category of the metric's target resource. Example: "events"

ThresholdBinding

Specifies a multi-level threshold to apply to apply to a metricBindings in the condition CEL expression.

JSON representation
{
  "variableId": string,
  "description": string,
  "thresholdValues": [
    {
      object (ThresholdValue)
    }
  ]
}
Fields
variableId

string

The variable id to be referenced in condition. Must be unique across all metricBindings and thresholdBindings.

description

string

Human readable description of the corresponding threshold and sub-requirement.

thresholdValues[]

object (ThresholdValue)

The values of the threshold. The values should be ordered from the most strict to the least strict.

ThresholdValue

Specifies a threshold value for a given severity.

JSON representation
{
  "severity": string,
  "value": number
}
Fields
severity

string

The severity of errors if the threshold is not met. It should be one of the severity fields in the requirement.

value

number

The value of the threshold.

ViolationSamplesBinding

Specifies a samples query and bind its result to a variable which will be used in the condition.

JSON representation
{
  "variableId": string,
  "sampleFilter": string,
  "description": string
}
Fields
variableId

string

The variable id to be referenced in condition.

sampleFilter

string

The filter string used for samples query.

Example: "sample.type = "retail.googleapis.com/userEvent" AND " "sample.labels.event_type = "PURCHASE" "

description

string

Description of this sample binding. Used by the UI to render user friendly descriptions for each requirement condition.

Should be less than 128 characters long.

MetricQueryResult

Metric result. The metric are in the requirementCondition.

JSON representation
{
  "name": string,
  "value": {
    object (TypedValue)
  },
  "timestamp": string,
  "unit": string,
  "metricType": string
}
Fields
name

string

This metric query name is mapping to variables in the requirementCondition.

value

object (TypedValue)

Value of the metric query.

timestamp

string (Timestamp format)

Time corresponding to when this metric value was calculated.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

unit

string

The unit in which this metric is reported. Follows

The Unified Code for Units of Measure standard.

metricType

string

Type identifier of the metric corresponding to this query result.