# Stackdriver Trace V2 Client - Class BatchWriteSpansRequest (2.0.0)

2.0.0 (latest) 2.0.0-RC1 1.9.5 1.8.10 1.7.0 1.6.5 1.5.3 1.4.11 Reference documentation and code samples for the Stackdriver Trace V2 Client class BatchWriteSpansRequest.

The request message for the `BatchWriteSpans` method.

Generated from protobuf message `google.devtools.cloudtrace.v2.BatchWriteSpansRequest`

## Namespace

Google \\ Cloud \\ Trace \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. The name of the project where the spans belong. The format is `projects/[PROJECT_ID]`. |
| `↳ spans` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span>` Required. A list of new spans. The span names must not match existing spans, otherwise the results are undefined. |

### getName

Required. The name of the project where the spans belong. The format is
`projects/[PROJECT_ID]`.

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

### setName

Required. The name of the project where the spans belong. The format is
`projects/[PROJECT_ID]`.

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

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

### getSpans

Required. A list of new spans. The span names must not match existing
spans, otherwise the results are undefined.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span>` |   |

### setSpans

Required. A list of new spans. The span names must not match existing
spans, otherwise the results are undefined.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span>` |

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` Required. The name of the project where the spans belong. The format is `projects/[PROJECT_ID]`. Please see TraceServiceClient::projectName() for help formatting this field. |
| `spans` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span>` Required. A list of new spans. The span names must not match existing spans, otherwise the results are undefined. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.BatchWriteSpansRequest` |   |