# Stackdriver Monitoring V3 Client - Class Service (2.2.2)

2.2.2 (latest) 2.2.1 2.1.2 2.0.1 1.12.1 1.11.1 1.10.3 1.9.0 1.8.0 1.7.1 1.6.0 1.5.1 1.4.0 1.3.2 1.2.2 Reference documentation and code samples for the Stackdriver Monitoring V3 Client class Service.

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.

Generated from protobuf message `google.monitoring.v3.Service`

## Namespace

Google \\ Cloud \\ Monitoring \\ V3

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. Resource name for this Service. The format is: projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\] |
| `↳ display_name` | `string` Name used for UI elements listing this Service. |
| `↳ custom` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Custom` Custom service type. |
| `↳ app_engine` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.AppEngine` Type used for App Engine services. |
| `↳ cloud_endpoints` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudEndpoints` Type used for Cloud Endpoints services. |
| `↳ cluster_istio` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.ClusterIstio` Type used for Istio services that live in a Kubernetes cluster. |
| `↳ mesh_istio` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.MeshIstio` Type used for Istio services scoped to an Istio mesh. |
| `↳ istio_canonical_service` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.IstioCanonicalService` Type used for canonical services scoped to an Istio mesh. Metrics for Istio are [documented here](https://istio.io/latest/docs/reference/config/metrics/) |
| `↳ cloud_run` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudRun` Type used for Cloud Run services. |
| `↳ gke_namespace` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeNamespace` Type used for GKE Namespaces. |
| `↳ gke_workload` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeWorkload` Type used for GKE Workloads. |
| `↳ gke_service` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeService` Type used for GKE Services (the Kubernetes concept of a service). |
| `↳ basic_service` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.BasicService` 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). |
| `↳ telemetry` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Telemetry` Configuration for how to query telemetry on a Service. |
| `↳ user_labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` 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. |

### getName

Identifier. Resource name for this Service. The format is:
projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\]

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. Resource name for this Service. The format is:
projects/\[PROJECT_ID_OR_NUMBER\]/services/\[SERVICE_ID\]

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

Name used for UI elements listing this Service.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

Name used for UI elements listing this Service.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCustom

Custom service type.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Custom|null` |   |

### hasCustom

### setCustom

Custom service type.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Custom` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAppEngine

Type used for App Engine services.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.AppEngine|null` |   |

### hasAppEngine

### setAppEngine

Type used for App Engine services.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.AppEngine` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCloudEndpoints

Type used for Cloud Endpoints services.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudEndpoints|null` |   |

### hasCloudEndpoints

### setCloudEndpoints

Type used for Cloud Endpoints services.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudEndpoints` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getClusterIstio

Type used for Istio services that live in a Kubernetes cluster.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.ClusterIstio|null` |   |

### hasClusterIstio

### setClusterIstio

Type used for Istio services that live in a Kubernetes cluster.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.ClusterIstio` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMeshIstio

Type used for Istio services scoped to an Istio mesh.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.MeshIstio|null` |   |

### hasMeshIstio

### setMeshIstio

Type used for Istio services scoped to an Istio mesh.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.MeshIstio` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIstioCanonicalService

Type used for canonical services scoped to an Istio mesh.

Metrics for Istio are
[documented here](https://istio.io/latest/docs/reference/config/metrics/)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.IstioCanonicalService|null` |   |

### hasIstioCanonicalService

### setIstioCanonicalService

Type used for canonical services scoped to an Istio mesh.

Metrics for Istio are
[documented here](https://istio.io/latest/docs/reference/config/metrics/)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.IstioCanonicalService` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCloudRun

Type used for Cloud Run services.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudRun|null` |   |

### hasCloudRun

### setCloudRun

Type used for Cloud Run services.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.CloudRun` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGkeNamespace

Type used for GKE Namespaces.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeNamespace|null` |   |

### hasGkeNamespace

### setGkeNamespace

Type used for GKE Namespaces.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeNamespace` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGkeWorkload

Type used for GKE Workloads.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeWorkload|null` |   |

### hasGkeWorkload

### setGkeWorkload

Type used for GKE Workloads.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeWorkload` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGkeService

Type used for GKE Services (the Kubernetes concept of a service).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeService|null` |   |

### hasGkeService

### setGkeService

Type used for GKE Services (the Kubernetes concept of a service).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.GkeService` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBasicService

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.BasicService|null` |   |

### hasBasicService

### clearBasicService

### setBasicService

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.BasicService` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTelemetry

Configuration for how to query telemetry on a Service.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Telemetry|null` |   |

### hasTelemetry

### clearTelemetry

### setTelemetry

Configuration for how to query telemetry on a Service.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-monitoring/latest/V3.Service.Telemetry` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUserLabels

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setUserLabels

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIdentifier

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |