MonitoredResource

表示可用于监控、日志记录、结算或其他目的的资源的对象。示例包括虚拟机实例、数据库和存储设备(例如磁盘)。type 字段用于标识描述资源架构的 MonitoredResourceDescriptor 对象。labels 字段中的信息根据架构标识实际资源及其属性。例如,某个特定的 Compute Engine 虚拟机实例可由以下对象表示,因为 "gce_instance"MonitoredResourceDescriptor 具有标签 "project_id""instance_id""zone"

{ "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 虚拟机实例的类型为 gce_instance。某些描述符会在类型中包含服务名称;例如,Datastream 流的类型为 datastream.googleapis.com/Stream

labels

map (key: string, value: string)

必需。关联的受监控资源描述符中列出的所有标签的值。例如,Compute Engine 虚拟机实例使用标签 "project_id""instance_id""zone"