Interface TraceUtil.Span (3.24.3)

public static interface TraceUtil.Span

Represents a trace span.

Methods

<T>endAtFuture(ApiFuture<T> futureValue)

public abstract void <T>endAtFuture(ApiFuture<T> futureValue)

If an operation ends in the future, its relevant span should end after the future has been completed. This method "appends" the span completion code at the completion of the given future. In order for telemetry info to be recorded, the future returned by this method should be completed.

Parameter
Name Description
futureValue ApiFuture<T>

addEvent(String name)

public abstract TraceUtil.Span addEvent(String name)

Adds the given event to this span.

Parameter
Name Description
name String
Returns
Type Description
TraceUtil.Span

addEvent(String name, Map<String,Object> attributes)

public abstract TraceUtil.Span addEvent(String name, Map<String,Object> attributes)

Adds the given event with the given attributes to this span.

Parameters
Name Description
name String
attributes Map<String,Object>
Returns
Type Description
TraceUtil.Span

end()

public abstract void end()

Ends this span.

end(Throwable error)

public abstract void end(Throwable error)

Ends this span in an error.

Parameter
Name Description
error Throwable

makeCurrent()

public abstract TraceUtil.Scope makeCurrent()

Marks this span as the current span.

Returns
Type Description
TraceUtil.Scope

setAttribute(String key, boolean value)

public abstract TraceUtil.Span setAttribute(String key, boolean value)

Adds the given attribute to this span.

Parameters
Name Description
key String
value boolean
Returns
Type Description
TraceUtil.Span

setAttribute(String key, int value)

public abstract TraceUtil.Span setAttribute(String key, int value)

Adds the given attribute to this span.

Parameters
Name Description
key String
value int
Returns
Type Description
TraceUtil.Span

setAttribute(String key, String value)

public abstract TraceUtil.Span setAttribute(String key, String value)

Adds the given attribute to this span.

Parameters
Name Description
key String
value String
Returns
Type Description
TraceUtil.Span