# Stackdriver Trace V1 Client - Class Trace (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 V1 Client class Trace.

A trace describes how long it takes for an application to perform an
operation. It consists of a set of spans, each of which represent a single
timed event within the operation.

Generated from protobuf message `google.devtools.cloudtrace.v1.Trace`

## Namespace

Google \\ Cloud \\ Trace \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ project_id` | `string` Project ID of the Cloud project where the trace data is stored. |
| `↳ trace_id` | `string` Globally unique identifier for the trace. This identifier is a 128-bit numeric value formatted as a 32-byte hex string. For example, `382d4f4c6b7bb2f4a972559d9085001d`. |
| `↳ spans` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V1.TraceSpan>` Collection of spans in the trace. |

### getProjectId

Project ID of the Cloud project where the trace data is stored.

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

### setProjectId

Project ID of the Cloud project where the trace data is stored.

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

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

### getTraceId

Globally unique identifier for the trace. This identifier is a 128-bit
numeric value formatted as a 32-byte hex string. For example,
`382d4f4c6b7bb2f4a972559d9085001d`.

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

### setTraceId

Globally unique identifier for the trace. This identifier is a 128-bit
numeric value formatted as a 32-byte hex string. For example,
`382d4f4c6b7bb2f4a972559d9085001d`.

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

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

### getSpans

Collection of spans in the trace.

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

### setSpans

Collection of spans in the trace.

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

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