Package com.linkedin.venice.listener
Class ServerStatsContext
- java.lang.Object
-
- com.linkedin.venice.listener.ServerStatsContext
-
public class ServerStatsContext extends java.lang.Object
We need to be able to record server side statistics for gRPC requests. The current StatsHandler in the Netty Pipeline maintains instance variables per channel, and guarantees that each request will be handled by the same thread, thus we cannot augment StatsHandler in the same way as other handlers for gRPC requests. We create a new StatsContext for each gRPC request, so we can maintain per request stats which will be aggregated on request completion using references to the proper Metrics Repository in AggServerHttpRequestStats. This class is almost a direct copy of StatsHandler, without Netty Channel Read/Write logic.
-
-
Constructor Summary
Constructors Constructor Description ServerStatsContext(AggServerHttpRequestStats singleGetStats, AggServerHttpRequestStats multiGetStats, AggServerHttpRequestStats computeStats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
errorRequest(ServerHttpRequestStats stats, double elapsedTime)
AggServerHttpRequestStats
getCurrentStats()
int
getRequestKeyCount()
long
getRequestStartTimeInNS()
io.netty.handler.codec.http.HttpResponseStatus
getResponseStatus()
java.lang.String
getStoreName()
void
incrementRequestPartCount()
boolean
isMetadataRequest()
boolean
isNewRequest()
boolean
isStatCallBackExecuted()
void
recordBasicMetrics(ServerHttpRequestStats serverHttpRequestStats)
void
resetContext()
void
setFirstPartLatency(double firstPartLatency)
void
setFlushLatency(double latency)
void
setMetadataRequest(boolean metadataRequest)
void
setMisroutedStoreVersion(boolean misroutedStoreVersion)
void
setNewRequest()
void
setPartsInvokeDelayLatency(double partsInvokeDelayLatency)
void
setReadResponseStats(ReadResponseStatsRecorder responseStatsRecorder)
void
setRequestInfo(RouterRequest request)
void
setRequestKeyCount(int keyCount)
void
setRequestSize(int requestSizeInBytes)
void
setRequestTerminatedEarly()
void
setRequestType(RequestType requestType)
void
setResponseSize(int size)
void
setResponseStatus(io.netty.handler.codec.http.HttpResponseStatus status)
void
setSecondPartLatency(double secondPartLatency)
void
setStatCallBackExecuted(boolean statCallbackExecuted)
void
setStoreName(java.lang.String name)
void
successRequest(ServerHttpRequestStats stats, double elapsedTime)
-
-
-
Constructor Detail
-
ServerStatsContext
public ServerStatsContext(AggServerHttpRequestStats singleGetStats, AggServerHttpRequestStats multiGetStats, AggServerHttpRequestStats computeStats)
-
-
Method Detail
-
isNewRequest
public boolean isNewRequest()
-
setSecondPartLatency
public void setSecondPartLatency(double secondPartLatency)
-
setPartsInvokeDelayLatency
public void setPartsInvokeDelayLatency(double partsInvokeDelayLatency)
-
incrementRequestPartCount
public void incrementRequestPartCount()
-
resetContext
public void resetContext()
-
setReadResponseStats
public void setReadResponseStats(ReadResponseStatsRecorder responseStatsRecorder)
-
setFirstPartLatency
public void setFirstPartLatency(double firstPartLatency)
-
setNewRequest
public void setNewRequest()
-
isMetadataRequest
public boolean isMetadataRequest()
-
isStatCallBackExecuted
public boolean isStatCallBackExecuted()
-
setStatCallBackExecuted
public void setStatCallBackExecuted(boolean statCallbackExecuted)
-
setResponseStatus
public void setResponseStatus(io.netty.handler.codec.http.HttpResponseStatus status)
-
getStoreName
public java.lang.String getStoreName()
-
setStoreName
public void setStoreName(java.lang.String name)
-
setMetadataRequest
public void setMetadataRequest(boolean metadataRequest)
-
setRequestTerminatedEarly
public void setRequestTerminatedEarly()
-
getResponseStatus
public io.netty.handler.codec.http.HttpResponseStatus getResponseStatus()
-
setRequestType
public void setRequestType(RequestType requestType)
-
setRequestKeyCount
public void setRequestKeyCount(int keyCount)
-
getCurrentStats
public AggServerHttpRequestStats getCurrentStats()
-
setRequestInfo
public void setRequestInfo(RouterRequest request)
-
setRequestSize
public void setRequestSize(int requestSizeInBytes)
-
getRequestStartTimeInNS
public long getRequestStartTimeInNS()
-
setFlushLatency
public void setFlushLatency(double latency)
-
setResponseSize
public void setResponseSize(int size)
-
recordBasicMetrics
public void recordBasicMetrics(ServerHttpRequestStats serverHttpRequestStats)
-
successRequest
public void successRequest(ServerHttpRequestStats stats, double elapsedTime)
-
errorRequest
public void errorRequest(ServerHttpRequestStats stats, double elapsedTime)
-
getRequestKeyCount
public int getRequestKeyCount()
-
setMisroutedStoreVersion
public void setMisroutedStoreVersion(boolean misroutedStoreVersion)
-
-