Reference documentation and code samples for the Stackdriver Trace Client class Link.
This plain PHP class represents a Link resource. 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.
Example:
use Google\Cloud\Trace\Link;
$link = new Link('abcd1234', 'abcd2345');
$span->addLink($link);
Namespace
Google \ Cloud \ Trace
Methods
__construct
Create a new Link.
Parameters
Name
Description
traceId
string
spanId
string
options
array
Configuration options.
↳ type
string
The relationship of the current span relative to the linked span. Defaults toTYPE_UNSPECIFIED.
↳ uncompressedSizeBytes
int
The number of uncompressed bytes sent or received.
↳ compressedSizeBytes
int
The number of compressed bytes sent or received. If missing assumed to be the same size as uncompressed.
info
Returns a serializable array representing this Link.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Stackdriver Trace Client - Class Link (1.8.10)\n\nVersion latestkeyboard_arrow_down\n\n- [1.8.10 (latest)](/php/docs/reference/cloud-trace/latest/Link)\n- [1.8.9](/php/docs/reference/cloud-trace/1.8.9/Link)\n- [1.7.0](/php/docs/reference/cloud-trace/1.7.0/Link)\n- [1.6.5](/php/docs/reference/cloud-trace/1.6.5/Link)\n- [1.5.3](/php/docs/reference/cloud-trace/1.5.3/Link)\n- [1.4.11](/php/docs/reference/cloud-trace/1.4.11/Link) \nReference documentation and code samples for the Stackdriver Trace Client class Link.\n\nThis plain PHP class represents a Link resource. A pointer from the current\nspan to another span in the same trace or in a different trace. For example,\nthis can be used in batching operations, where a single batch handler\nprocesses multiple requests from different traces or when the handler\nreceives a request from a different project.\n\nExample: \n\n use Google\\Cloud\\Trace\\Link;\n\n $link = new Link('abcd1234', 'abcd2345');\n $span-\u003eaddLink($link);\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Trace\n\nMethods\n-------\n\n### __construct\n\nCreate a new Link.\n\n### info\n\nReturns a serializable array representing this Link.\n\nConstants\n---------\n\n### TYPE_UNSPECIFIED\n\n Value: \\Google\\Cloud\\Trace\\V2\\Span\\Link\\Type::TYPE_UNSPECIFIED\n\n### TYPE_CHILD_LINKED_SPAN\n\n Value: \\Google\\Cloud\\Trace\\V2\\Span\\Link\\Type::CHILD_LINKED_SPAN\n\n### TYPE_PARENT_LINKED_SPAN\n\n Value: \\Google\\Cloud\\Trace\\V2\\Span\\Link\\Type::PARENT_LINKED_SPAN"]]