MonitoredResource

這是一個物件,代表可用於監控、記錄、計費或其他用途的資源。相關範例包括:虛擬機器執行個體、資料庫,以及儲存裝置 (例如磁碟)。type 欄位會識別描述資源結構定義的 MonitoredResourceDescriptor 物件。labels 欄位中的資訊會根據結構定義,識別實際資源及其屬性。舉例來說,特定 Compute Engine VM 執行個體可由下列物件表示,因為 "gce_instance" 的標籤為 "project_id""instance_id""zone"MonitoredResourceDescriptor

{ "type": "gce_instance",
  "labels": { "project_id": "my-project",
              "instance_id": "12345678901234",
              "zone": "us-central1-a" }}
JSON 表示法
{
  "type": string,
  "labels": {
    string: string,
    ...
  }
}
欄位
type

string

這是必要旗標,受監控的資源類型。這個欄位必須與 MonitoredResourceDescriptor 物件的 type 欄位相符。舉例來說,Compute Engine VM 執行個體的類型為 gce_instance。部分描述元會在類型中加入服務名稱,例如 Datastream 串流的類型為 datastream.googleapis.com/Stream

labels

map (key: string, value: string)

這是必要旗標,相關聯的受監控資源描述元中列出的所有標籤的值。舉例來說,Compute Engine VM 執行個體會使用 "project_id""instance_id""zone" 標籤。