Method: projects.locations.requirements.checkRequirement

查看特定規定。

HTTP 要求

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

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
location

string

這是必要旗標,地點的完整資源名稱。格式 projects/{project_number_or_id}/locations/{location}

要求主體

要求主體包含下列結構的資料:

JSON 表示法
{
  "requirementType": string,
  "resources": [
    {
      object (MonitoredResource)
    }
  ]
}
欄位
requirementType

string

指定要檢查的規定類型。支援的類型如下:

  • 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)

要檢查這項需求的資源。受監控資源所需的類型:

  • discoveryengine.googleapis.com/Branch

    • 這項資源需要的標籤:
      • project_number
      • location_id
      • collection_id
      • datastore_id
      • branch_id
  • discoveryengine.googleapis.com/DataStore

    • 這項資源需要的標籤:
      • project_number
      • location_id
      • collection_id
      • datastore_id

回應主體

requirements.checkRequirement 方法的回應。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{
  "requirement": {
    object (Requirement)
  },
  "requirementCondition": {
    object (Expr)
  },
  "metricResults": [
    {
      object (MetricQueryResult)
    }
  ],
  "oldestMetricTimestamp": string,
  "result": string
}
欄位
requirement

object (Requirement)

需求定義。

requirementCondition

object (Expr)

評估需求結果的條件。

metricResults[]

object (MetricQueryResult)

指標結果。

oldestMetricTimestamp

string (Timestamp format)

最舊的計算指標時間戳記 (即最舊的指標)。表示result可能無法準確反映此時間之後執行的任何活動和產品目錄更新。

使用 RFC 3339,產生的輸出內容一律會經過 Z 標準化,並使用 0、3、6 或 9 個小數點後位數。系統也接受「Z」以外的偏移量。例如:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

result

string

需求結果。這應該是需求定義中的其中一個 severity 欄位。如果評估期間發生任何錯誤,則為 UNKNOWN

授權範圍

需要下列其中一種 OAuth 範圍:

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

詳情請參閱Authentication Overview

需求

資料要求。

JSON 表示法
{
  "type": string,
  "displayName": string,
  "description": string,
  "condition": {
    object (Expr)
  },
  "metricBindings": [
    {
      object (MetricBinding)
    }
  ],
  "thresholdBindings": [
    {
      object (ThresholdBinding)
    }
  ],
  "violationSamplesBindings": [
    {
      object (ViolationSamplesBinding)
    }
  ],
  "severity": [
    string
  ]
}
欄位
type

string

做為 ID 的需求類型。ID 不得重複。

為避免可能發生衝突,型別應以服務名稱為前置字串。建議對類似需求使用自然階層式分組。

範例:

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

string

需求名稱。

description

string

需求說明。

condition

object (Expr)

評估需求結果的條件。

運算式中的變數應由 metrics_bindingsthresholdBindings 提供。其中 metrics_bindings 用於計算指標,thresholdBindings 則用於定義對應 metricBindings 的閾值。

metricBindings[]

object (MetricBinding)

要在 condition 中使用的指標繫結清單。

thresholdBindings[]

object (ThresholdBinding)

要在 condition 中使用的門檻繫結清單。

violationSamplesBindings[]

object (ViolationSamplesBinding)

要在 condition 中使用的指標繫結清單。

severity[]

string

如果未符合規定,錯誤的嚴重程度。且必須從最嚴格到最寬鬆依序排列。範例:

  • BLOCKING
  • CRITICAL
  • WARNING

規定中的所有門檻都必須具有此處的所有嚴重程度。

MetricBinding

指定指標查詢,並將結果繫結至 condition 中使用的變數。

JSON 表示法
{
  "variableId": string,
  "resourceType": string,
  "metricFilter": string,
  "description": string,
  "category": string
}
欄位
variableId

string

要在 condition 中參照的變數 ID。

resourceType

string

要監控指標的資源。

metricFilter

string

用於指標查詢的篩選器字串。

範例:

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

description

string

使用者可理解的對應指標篩選器說明。

category

string

指標目標資源的類別。例如:「Events」

ThresholdBinding

指定要套用至 condition CEL 運算式中 metricBindings 的多層級門檻。

JSON 表示法
{
  "variableId": string,
  "description": string,
  "thresholdValues": [
    {
      object (ThresholdValue)
    }
  ]
}
欄位
variableId

string

要在 condition 中參照的變數 ID。不得與任何 metricBindingsthresholdBindings 重複。

description

string

使用者可理解的對應門檻和子項規定說明。

thresholdValues[]

object (ThresholdValue)

門檻值。值應從最嚴格到最寬鬆排序。

ThresholdValue

指定特定嚴重程度的閾值。

JSON 表示法
{
  "severity": string,
  "value": number
}
欄位
severity

string

未達門檻時的錯誤嚴重程度。必須是需求中的 severity 欄位之一。

value

number

門檻值。

ViolationSamplesBinding

指定樣本查詢,並將結果繫結至 condition 中使用的變數。

JSON 表示法
{
  "variableId": string,
  "sampleFilter": string,
  "description": string
}
欄位
variableId

string

要在 condition 中參照的變數 ID。

sampleFilter

string

用於查詢樣本的篩選器字串。

範例:「sample.type = "retail.googleapis.com/userEvent" AND " "sample.labels.event_type = "PURCHASE" "」

description

string

這個範例繫結的說明。UI 會使用這項屬性,為每個需求條件顯示易於理解的說明。

長度應少於 128 個字元。

MetricQueryResult

指標結果。指標位於 requirementCondition 中。

JSON 表示法
{
  "name": string,
  "value": {
    object (TypedValue)
  },
  "timestamp": string,
  "unit": string,
  "metricType": string
}
欄位
name

string

這項指標查詢名稱會對應至 requirementCondition 中的變數。

value

object (TypedValue)

指標查詢的值。

timestamp

string (Timestamp format)

計算這個指標值時對應的時間。

使用 RFC 3339,產生的輸出內容一律會經過 Z 標準化,並使用 0、3、6 或 9 個小數點後位數。系統也接受「Z」以外的偏移量。例如:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

unit

string

這項指標的報告單位。追蹤者

The Unified Code for Units of Measure 標準。

metricType

string

與這項查詢結果對應的指標類型 ID。