# Stackdriver Trace V2 Client - Class Link (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 Link.

A pointer from the current span to another span in the same trace or in a
different trace. For example, this can be used in batching operations,
where a single batch handler processes multiple requests from different
traces or when the handler receives a request from a different project.

Generated from protobuf message `google.devtools.cloudtrace.v2.Span.Link`

## Namespace

Google \\ Cloud \\ Trace \\ V2 \\ Span

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ trace_id` | `string` The `[TRACE_ID]` for a trace within a project. |
| `↳ span_id` | `string` The `[SPAN_ID]` for a span within a trace. |
| `↳ type` | `int` The relationship of the current span relative to the linked span. |
| `↳ attributes` | `https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span.Attributes` A set of attributes on the link. Up to 32 attributes can be specified per link. |

### getTraceId

The `[TRACE_ID]` for a trace within a project.

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

### setTraceId

The `[TRACE_ID]` for a trace within a project.

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

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

### getSpanId

The `[SPAN_ID]` for a span within a trace.

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

### setSpanId

The `[SPAN_ID]` for a span within a trace.

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

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

### getType

The relationship of the current span relative to the linked span.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [Type](https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span.Link.Type). |

### setType

The relationship of the current span relative to the linked span.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [Type](https://docs.cloud.google.com/php/docs/reference/cloud-trace/latest/V2.Span.Link.Type). |

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

### getAttributes

A set of attributes on the link. Up to 32 attributes can be
specified per link.

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

### hasAttributes

### clearAttributes

### setAttributes

A set of attributes on the link. Up to 32 attributes can be
specified per link.

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

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