# Stackdriver Error Reporting V1beta1 Client - Class ServiceContext (0.26.1)

0.26.1 (latest) 0.26.0 0.25.3 0.24.0 0.23.1 0.22.10 0.21.1 0.20.2 0.19.12

> [!WARNING]
> **Beta**
>
>
> This library is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1)
> of the Terms of Service. Pre-GA libraries might have limited support,
> and changes to pre-GA libraries might not be compatible with other pre-GA versions.
> For more information, see the
> [launch stage descriptions](https://docs.cloud.google.com/products#product-launch-stages).

Reference documentation and code samples for the Stackdriver Error Reporting V1beta1 Client class ServiceContext.

Describes a running service that sends errors.

Its version changes over time and multiple versions can run in parallel.

Generated from protobuf message `google.devtools.clouderrorreporting.v1beta1.ServiceContext`

## Namespace

Google \\ Cloud \\ ErrorReporting \\ V1beta1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ service` | `string` An identifier of the service, such as the name of the executable, job, or Google App Engine service name. This field is expected to have a low number of values that are relatively stable over time, as opposed to `version`, which can be changed whenever new code is deployed. Contains the service name for error reports extracted from Google App Engine logs or `default` if the App Engine default service is used. |
| `↳ version` | `string` Represents the source code version that the developer provided, which could represent a version label or a Git SHA-1 hash, for example. For App Engine standard environment, the version is set to the version of the app. |
| `↳ resource_type` | `string` Type of the MonitoredResource. List of possible values: <https://cloud.google.com/monitoring/api/resources> Value is set automatically for incoming errors and must not be set when reporting errors. |

### getService

An identifier of the service, such as the name of the
executable, job, or Google App Engine service name. This field is expected
to have a low number of values that are relatively stable over time, as
opposed to `version`, which can be changed whenever new code is deployed.

Contains the service name for error reports extracted from Google
App Engine logs or `default` if the App Engine default service is used.

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

### setService

An identifier of the service, such as the name of the
executable, job, or Google App Engine service name. This field is expected
to have a low number of values that are relatively stable over time, as
opposed to `version`, which can be changed whenever new code is deployed.

Contains the service name for error reports extracted from Google
App Engine logs or `default` if the App Engine default service is used.

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

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

### getVersion

Represents the source code version that the developer provided,
which could represent a version label or a Git SHA-1 hash, for example.

For App Engine standard environment, the version is set to the version of
the app.

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

### setVersion

Represents the source code version that the developer provided,
which could represent a version label or a Git SHA-1 hash, for example.

For App Engine standard environment, the version is set to the version of
the app.

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

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

### getResourceType

Type of the MonitoredResource. List of possible values:
<https://cloud.google.com/monitoring/api/resources>
Value is set automatically for incoming errors and must not be set when
reporting errors.

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

### setResourceType

Type of the MonitoredResource. List of possible values:
<https://cloud.google.com/monitoring/api/resources>
Value is set automatically for incoming errors and must not be set when
reporting errors.

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

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