Span
Span represents a logical unit of work as part of a broader Trace. Examples of span might include remote procedure calls or a in-process function calls to sub-components. A Trace has a single, top-level "root" Span that in turn may have zero or more child Spans, which in turn may have children.
Constructor Summary
| Public Constructor | ||
| public |
constructor(imp: *) Constructs a new Span object. |
|
Method Summary
| Public Methods | ||
| public |
addTags(keyValuePairs: *): [type] Adds the given key value pairs to the set of span tags. |
|
| public |
Indicates that the unit of work represented by the span is complete or has otherwise been terminated. |
|
| public |
getBaggageItem(key: string): string Returns the value for the given baggage item key. |
|
| public |
imp(): * Returns the Span implementation object. |
|
| public |
Explicitly create a log record associated with the span. |
|
| public |
Logs a event with an optional payload. |
|
| public |
setBaggageItem(key: string, value: string): * Set an arbitrary key-value string pair that will be carried along the full path of a trace. |
|
| public |
setOperationName(name: string): * Sets the string name for the logical operation this span represents. |
|
| public |
Adds a single tag to the span. |
|
| public |
Returns the Tracer object used to create this Span. |
|
Public Constructors
public constructor(imp: *) source
Constructs a new Span object. This method should not be called directly.
Params:
| Name | Type | Attribute | Description |
| imp | * |
Public Methods
public addTags(keyValuePairs: *): [type] source
Adds the given key value pairs to the set of span tags.
Multiple calls to addTags() results in the tags being the superset of all calls.
The behavior of setting the same key multiple times on the same span is undefined.
The supported type of the values is implementation-dependent. Implementations are expected to safely handle all types of values but may choose to ignore unrecognized / unhandle-able values (e.g. objects with cyclic references, function objects).
Params:
| Name | Type | Attribute | Description |
| keyValuePairs | * |
Return:
| [type] | [description] |
public finish(finishTime: Number) source
Indicates that the unit of work represented by the span is complete or has otherwise been terminated.
All Span objects must have finish() called on them before they are reported to the backend implementation.
Once finish() is called on a Span object, the behavior of all methods
on the object is considered undefined.
Params:
| Name | Type | Attribute | Description |
| finishTime | Number | Optional finish time in milliseconds as a Unix timestamp. Decimal values are supported for timestamps with sub-millisecond accuracy. If not specified, the current time (as defined by the implementation) will be used. |
public getBaggageItem(key: string): string source
Returns the value for the given baggage item key.
Params:
| Name | Type | Attribute | Description |
| key | string | The key for the given trace attribute. |
Return:
| string | String value for the given key, or undefined if the key does not correspond to a set trace attribute. |
public imp(): * source
Returns the Span implementation object. The returned object is by its nature entirely implementation-dependent.
Return:
| * |
public log(fields: object): * source
Explicitly create a log record associated with the span.
Params:
| Name | Type | Attribute | Description |
| fields | object | object containing the log record properties |
|
| fields.timestamp | number |
|
optional field specifying the timestamp in milliseconds as a Unix timestamp. Fractional values are allowed so that timestamps with sub-millisecond accuracy can be represented. If not specified, the implementation is expected to use it's notion of the current time of the call. |
| fields.event | string |
|
the event name |
| fields.payload | object |
|
an arbitrary structured payload. It is implementation-dependent how this will be processed. |
Return:
| * |
public logEvent(eventName: string, payload: object): * source
Logs a event with an optional payload.
Return:
| * |
public setBaggageItem(key: string, value: string): * source
Set an arbitrary key-value string pair that will be carried along the full path of a trace.
All spans created as children of this span will inherit the baggage items of this span.
Baggage items are copied between all spans, both in-process and across distributed requests, therefore this feature should be used with care to ensure undue overhead is not incurred.
Keys are case insensitive and must match the regular expresssion
[a-z0-9][-a-z0-9]*.
Return:
| * |
public setOperationName(name: string): * source
Sets the string name for the logical operation this span represents.
Params:
| Name | Type | Attribute | Description |
| name | string |
Return:
| * |