{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-monitoring/json-schema/google-cloud-monitoring-service-schema.json",
  "title": "Service",
  "description": "A Service is a discrete, autonomous, and network-accessible unit, designed to solve an individual concern (Wikipedia (https://en.wikipedia.org/wiki/Service-orientation)). In Cloud Monitoring, a Service acts as the root resource under which operational aspects of the service are accessible.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-monitoring-services-api-openapi.yml#/components/schemas/Service",
  "properties": {
    "telemetry": {
      "$ref": "#/$defs/Telemetry",
      "description": "Configuration for how to query telemetry on a Service."
    },
    "cloudEndpoints": {
      "$ref": "#/$defs/CloudEndpoints",
      "description": "Type used for Cloud Endpoints services."
    },
    "meshIstio": {
      "$ref": "#/$defs/MeshIstio",
      "description": "Type used for Istio services scoped to an Istio mesh."
    },
    "userLabels": {
      "description": "Labels which have been used to annotate the service. Label keys must start with a letter. Label keys and values may contain lowercase letters, numbers, underscores, and dashes. Label keys and values have a maximum length of 63 characters, and must be less than 128 bytes in size. Up to 64 label entries may be stored. For labels which do not have a semantic value, the empty string may be supplied for the label value.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "displayName": {
      "description": "Name used for UI elements listing this Service.",
      "type": "string"
    },
    "name": {
      "type": "string",
      "description": "Identifier. Resource name for this Service. The format is: projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] "
    },
    "appEngine": {
      "$ref": "#/$defs/AppEngine",
      "description": "Type used for App Engine services."
    },
    "custom": {
      "$ref": "#/$defs/Custom",
      "description": "Custom service type."
    },
    "istioCanonicalService": {
      "$ref": "#/$defs/IstioCanonicalService",
      "description": "Type used for canonical services scoped to an Istio mesh. Metrics for Istio are documented here (https://istio.io/latest/docs/reference/config/metrics/)"
    },
    "cloudRun": {
      "$ref": "#/$defs/CloudRun",
      "description": "Type used for Cloud Run services."
    },
    "gkeNamespace": {
      "$ref": "#/$defs/GkeNamespace",
      "description": "Type used for GKE Namespaces."
    },
    "clusterIstio": {
      "$ref": "#/$defs/ClusterIstio",
      "description": "Type used for Istio services that live in a Kubernetes cluster."
    },
    "basicService": {
      "$ref": "#/$defs/BasicService",
      "description": "Message that contains the service type and service labels of this service if it is a basic service. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli)."
    },
    "gkeWorkload": {
      "$ref": "#/$defs/GkeWorkload",
      "description": "Type used for GKE Workloads."
    },
    "gkeService": {
      "$ref": "#/$defs/GkeService",
      "description": "Type used for GKE Services (the Kubernetes concept of a service)."
    }
  },
  "type": "object",
  "$defs": {
    "AppEngine": {
      "properties": {
        "moduleId": {
          "description": "The ID of the App Engine module underlying this service. Corresponds to the module_id resource label in the gae_app monitored resource (https://cloud.google.com/monitoring/api/resources#tag_gae_app).",
          "type": "string"
        }
      },
      "description": "App Engine service. Learn more at https://cloud.google.com/appengine.",
      "type": "object"
    },
    "BasicService": {
      "properties": {
        "serviceType": {
          "description": "The type of service that this basic service defines, e.g. APP_ENGINE service type. Documentation and valid values here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).",
          "type": "string"
        },
        "serviceLabels": {
          "type": "object",
          "description": "Labels that specify the resource that emits the monitoring data which is used for SLO reporting of this Service. Documentation and valid values for given service types here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "description": "A well-known service type, defined by its service type and service labels. Documentation and examples here (https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/api-structures#basic-svc-w-basic-sli).",
      "type": "object"
    },
    "CloudEndpoints": {
      "type": "object",
      "properties": {
        "service": {
          "description": "The name of the Cloud Endpoints service underlying this service. Corresponds to the service resource label in the api monitored resource (https://cloud.google.com/monitoring/api/resources#tag_api).",
          "type": "string"
        }
      },
      "description": "Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints."
    },
    "CloudRun": {
      "type": "object",
      "description": "Cloud Run service. Learn more at https://cloud.google.com/run.",
      "properties": {
        "location": {
          "description": "The location the service is run. Corresponds to the location resource label in the cloud_run_revision monitored resource (https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).",
          "type": "string"
        },
        "serviceName": {
          "description": "The name of the Cloud Run service. Corresponds to the service_name resource label in the cloud_run_revision monitored resource (https://cloud.google.com/monitoring/api/resources#tag_cloud_run_revision).",
          "type": "string"
        }
      }
    },
    "ClusterIstio": {
      "type": "object",
      "description": "Istio service scoped to a single Kubernetes cluster. Learn more at https://istio.io. Clusters running OSS Istio will have their services ingested as this type.",
      "properties": {
        "serviceNamespace": {
          "type": "string",
          "description": "The namespace of the Istio service underlying this service. Corresponds to the destination_service_namespace metric label in Istio metrics."
        },
        "clusterName": {
          "type": "string",
          "description": "The name of the Kubernetes cluster in which this Istio service is defined. Corresponds to the cluster_name resource label in k8s_cluster resources."
        },
        "location": {
          "type": "string",
          "description": "The location of the Kubernetes cluster in which this Istio service is defined. Corresponds to the location resource label in k8s_cluster resources."
        },
        "serviceName": {
          "type": "string",
          "description": "The name of the Istio service underlying this service. Corresponds to the destination_service_name metric label in Istio metrics."
        }
      }
    },
    "Custom": {
      "type": "object",
      "properties": {},
      "description": "Use a custom service to designate a service that you want to monitor when none of the other service types (like App Engine, Cloud Run, or a GKE type) matches your intended service."
    },
    "GkeNamespace": {
      "properties": {
        "namespaceName": {
          "type": "string",
          "description": "The name of this namespace."
        },
        "location": {
          "type": "string",
          "description": "The location of the parent cluster. This may be a zone or region."
        },
        "clusterName": {
          "description": "The name of the parent cluster.",
          "type": "string"
        },
        "projectId": {
          "readOnly": true,
          "description": "Output only. The project this resource lives in. For legacy services migrated from the Custom type, this may be a distinct project from the one parenting the service itself.",
          "type": "string"
        }
      },
      "type": "object",
      "description": "GKE Namespace. The field names correspond to the resource metadata labels on monitored resources that fall under a namespace (for example, k8s_container or k8s_pod)."
    },
    "GkeService": {
      "properties": {
        "namespaceName": {
          "type": "string",
          "description": "The name of the parent namespace."
        },
        "serviceName": {
          "description": "The name of this service.",
          "type": "string"
        },
        "projectId": {
          "type": "string",
          "readOnly": true,
          "description": "Output only. The project this resource lives in. For legacy services migrated from the Custom type, this may be a distinct project from the one parenting the service itself."
        },
        "location": {
          "description": "The location of the parent cluster. This may be a zone or region.",
          "type": "string"
        },
        "clusterName": {
          "description": "The name of the parent cluster.",
          "type": "string"
        }
      },
      "description": "GKE Service. The \"service\" here represents a Kubernetes service object (https://kubernetes.io/docs/concepts/services-networking/service). The field names correspond to the resource labels on k8s_service monitored resources (https://cloud.google.com/monitoring/api/resources#tag_k8s_service).",
      "type": "object"
    },
    "GkeWorkload": {
      "properties": {
        "projectId": {
          "readOnly": true,
          "description": "Output only. The project this resource lives in. For legacy services migrated from the Custom type, this may be a distinct project from the one parenting the service itself.",
          "type": "string"
        },
        "topLevelControllerName": {
          "type": "string",
          "description": "The name of this workload."
        },
        "location": {
          "type": "string",
          "description": "The location of the parent cluster. This may be a zone or region."
        },
        "topLevelControllerType": {
          "type": "string",
          "description": "The type of this workload (for example, \"Deployment\" or \"DaemonSet\")"
        },
        "namespaceName": {
          "description": "The name of the parent namespace.",
          "type": "string"
        },
        "clusterName": {
          "type": "string",
          "description": "The name of the parent cluster."
        }
      },
      "type": "object",
      "description": "A GKE Workload (Deployment, StatefulSet, etc). The field names correspond to the metadata labels on monitored resources that fall under a workload (for example, k8s_container or k8s_pod)."
    },
    "IstioCanonicalService": {
      "type": "object",
      "description": "Canonical service scoped to an Istio mesh. Anthos clusters running ASM >= 1.6.8 will have their services ingested as this type.",
      "properties": {
        "meshUid": {
          "description": "Identifier for the Istio mesh in which this canonical service is defined. Corresponds to the mesh_uid metric label in Istio metrics (https://cloud.google.com/monitoring/api/metrics_istio).",
          "type": "string"
        },
        "canonicalServiceNamespace": {
          "description": "The namespace of the canonical service underlying this service. Corresponds to the destination_canonical_service_namespace metric label in Istio metrics (https://cloud.google.com/monitoring/api/metrics_istio).",
          "type": "string"
        },
        "canonicalService": {
          "type": "string",
          "description": "The name of the canonical service underlying this service. Corresponds to the destination_canonical_service_name metric label in label in Istio metrics (https://cloud.google.com/monitoring/api/metrics_istio)."
        }
      }
    },
    "MeshIstio": {
      "type": "object",
      "description": "Istio service scoped to an Istio mesh. Anthos clusters running ASM < 1.6.8 will have their services ingested as this type.",
      "properties": {
        "meshUid": {
          "description": "Identifier for the mesh in which this Istio service is defined. Corresponds to the mesh_uid metric label in Istio metrics.",
          "type": "string"
        },
        "serviceNamespace": {
          "description": "The namespace of the Istio service underlying this service. Corresponds to the destination_service_namespace metric label in Istio metrics.",
          "type": "string"
        },
        "serviceName": {
          "description": "The name of the Istio service underlying this service. Corresponds to the destination_service_name metric label in Istio metrics.",
          "type": "string"
        }
      }
    },
    "Telemetry": {
      "properties": {
        "resourceName": {
          "description": "The full name of the resource that defines this service. Formatted as described in https://cloud.google.com/apis/design/resource_names.",
          "type": "string"
        }
      },
      "description": "Configuration for how to query telemetry on a Service.",
      "type": "object"
    }
  }
}