new Segment(name, rootIdopt, parentIdopt)
Represents a segment.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of the subsegment. | |
rootId |
string |
<optional> |
The trace ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request. If one is not supplied, it will be generated. |
parentId |
string |
<optional> |
The sub/segment ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request. |
- Source:
Methods
addAnnotation(key, value)
Adds a key-value pair that can be queryable through GetTraceSummaries.
Only acceptable types are string, float/int and boolean.
Parameters:
Name | Type | Description |
---|---|---|
key |
string | The name of key to add. |
value |
boolean | string | number | The value to add for the given key. |
- Source:
addError(err, remoteopt)
Adds error data into the segment.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error | string | The error to capture. | |
remote |
boolean |
<optional> |
Flag for whether the exception caught was remote or not. |
- Source:
addErrorFlag()
Adds error flag to the subsegment.
- Source:
addFaultFlag()
Adds fault flag to the subsegment.
- Source:
addIncomingRequestData(data)
Adds incoming request data to the http block of the segment.
Parameters:
Name | Type | Description |
---|---|---|
data |
IncomingRequestData | The data of the property to add. |
- Source:
addMetadata(key, value, namespaceopt)
Adds a key-value pair to the metadata.default attribute when no namespace is given.
Metadata is not queryable, but is recorded.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
string | The name of the key to add. | |
value |
object | null | The value of the associated key. | |
namespace |
string |
<optional> |
The property name to put the key/value pair under. |
- Source:
addNewSubsegment(name)
Adds a new subsegment to the array of subsegments.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the new subsegment to append. |
- Source:
addPluginData(data)
Adds a service with associated version data into the segment.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | The associated AWS data. |
- Source:
addSubsegment(subsegment)
Adds a subsegment to the array of subsegments.
Parameters:
Name | Type | Description |
---|---|---|
subsegment |
Subsegment | The subsegment to append. |
- Source:
addThrottleFlag()
Adds throttle flag to the subsegment.
- Source:
close(erropt, remoteopt)
Closes the current segment. This automatically sets the end time.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error | string |
<optional> |
The error to capture. |
remote |
boolean |
<optional> |
Flag for whether the exception caught was remote or not. |
- Source:
decrementCounter()
Each segment holds a counter of open subsegments. This decrements
the counter such that it can be called from a child and propagate up.
- Source:
flush()
Sends the segment to the daemon.
- Source:
incrementCounter(additionalopt)
Each segment holds a counter of open subsegments. This increments the counter.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
additional |
Number |
<optional> |
An additional amount to increment. Used when adding subsegment trees. |
- Source:
isClosed() → {boolean}
Returns a boolean indicating whether or not the segment has been closed.
- Source:
Returns:
- Returns true if the subsegment is closed.
- Type
- boolean
removeSubsegment()
Removes the subsegment from the subsegments array, used in subsegment streaming.
- Source:
setSDKData(data)
Adds data about the AWS X-Ray SDK onto the segment.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Object that contains the version of the SDK, and other information. |
- Source:
setServiceData(data)
Adds data about the service into the segment.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Object that contains the version of the application, and other information. |
- Source:
setUser(user)
Adds a User ID that can be queried from the X-Ray console. User ID
must be a string.
Parameters:
Name | Type | Description |
---|---|---|
user |
string | The ID of the user corresponding to this segment |
- Source: