public final class ObservedTotalDuration extends Base
SimpleMetricsSphereClient.execute(SphereRequest)
until the CompletionStage
is completed.
Due to multithreading issues (counter start and end is in different Threads) be aware that is measurement is not perfectly accurate.
Modifier and Type | Field and Description |
---|---|
protected Long |
durationInMilliseconds |
protected SphereRequest<?> |
request |
protected String |
requestId |
Modifier and Type | Method and Description |
---|---|
String |
getCorrelationId() |
Long |
getDurationInMilliseconds()
The duration in milliseconds.
|
Throwable |
getErrorResult() |
SphereRequest<?> |
getRequest()
The sphere request related to the observed duration.
|
String |
getRequestId()
The
SimpleMetricsSphereClient adds a request ID to each SphereRequest , so that ObservedDuration s belonging to the same request can be associated.. |
Object |
getSuccessResult() |
String |
getTopic()
A String to describe the topic associated with the observed duration (e.g.
|
static ObservedTotalDuration |
of(long durationInMilliseconds,
String sphereRequestId,
SphereRequest<?> request,
String correlationId) |
static ObservedTotalDuration |
of(long durationInMilliseconds,
String sphereRequestId,
SphereRequest<?> request,
String correlationId,
Object successResult,
Throwable errorResult) |
protected final String requestId
protected final Long durationInMilliseconds
protected final SphereRequest<?> request
public static ObservedTotalDuration of(long durationInMilliseconds, String sphereRequestId, SphereRequest<?> request, @Nullable String correlationId)
public static ObservedTotalDuration of(long durationInMilliseconds, String sphereRequestId, SphereRequest<?> request, @Nullable String correlationId, @Nullable Object successResult, @Nullable Throwable errorResult)
public Long getDurationInMilliseconds()
ObservedDuration
getDurationInMilliseconds
in interface ObservedDuration
public String getRequestId()
ObservedDuration
SimpleMetricsSphereClient
adds a request ID to each SphereRequest
, so that ObservedDuration
s belonging to the same request can be associated..
This is necessary since a SphereRequest
can be reused for multiple requests.
getRequestId
in interface ObservedDuration
public SphereRequest<?> getRequest()
ObservedDuration
getRequest
in interface ObservedDuration
public final String getTopic()
ObservedDuration
getTopic
in interface ObservedDuration