Interface ConsumerMetrics
- All Known Implementing Classes:
OtelMetrics
public interface ConsumerMetrics
Interface for tracking and recording metrics related to the processing of messages and requests
in the
Consumer. Provides methods to increment counters, record timing metrics, and
capture other performance-related data points.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a timer interface used for measuring and observing the duration of tasks. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConsumerMetricsNo-op implementation ofConsumerMetrics. -
Method Summary
Modifier and TypeMethodDescriptionvoidIncrements the counter for collapsed "add" requests.default voidIncrements the counter for input messages.voidincrementInputMsgCounter(long delta) Increments the counter for input messages.default voidincrementInputReqCounter(String type, String subType) Increments the counter for input requests by type and subtype.voidincrementInputReqCounter(String type, String subType, int delta) Increments the counter for input requests by type, subtype, and delta.default voidincrementOutputCounter(String type, String result) Increments the counter for output requests by type and result.voidincrementOutputCounter(String type, String result, int delta) Increments the counter for output requests by type, result, and delta.voidrecordOutputBackoffTime(MirroredSolrRequest.Type type, long backoffTimeMs) Records the backoff time for output requests.voidrecordOutputBatchSize(MirroredSolrRequest.Type type, org.apache.solr.client.solrj.SolrRequest<?> solrRequest) Records the batch size of the output request.voidrecordOutputFirstAttemptTime(MirroredSolrRequest.Type type, long firstAttemptTimeMs) Records the latency between the time when the message was sent at source and the time of the first attempt at processing.startOutputTimeTimer(String requestType) Starts a timer to measure the duration of an output request processing by the given request type.
-
Field Details
-
NOOP
No-op implementation ofConsumerMetrics.
-
-
Method Details
-
incrementInputMsgCounter
default void incrementInputMsgCounter()Increments the counter for input messages. -
incrementInputMsgCounter
void incrementInputMsgCounter(long delta) Increments the counter for input messages.- Parameters:
delta- increase the counter by this value
-
incrementCollapsedCounter
void incrementCollapsedCounter()Increments the counter for collapsed "add" requests. -
incrementInputReqCounter
Increments the counter for input requests by type and subtype.- Parameters:
type- request type, one ofMirroredSolrRequest.Typevalues.subType- additional subtype: add, delete_by_id, delete_by_query, or action for other request types.
-
incrementInputReqCounter
Increments the counter for input requests by type, subtype, and delta.- Parameters:
type- request type, one ofMirroredSolrRequest.Typevalues.subType- additional subtype: add, delete_by_id, delete_by_query, or action for other request types.delta- increase the counter by this value
-
incrementOutputCounter
Increments the counter for output requests by type and result.- Parameters:
type- the type of the requestresult- the result of the request, such as success or failure
-
incrementOutputCounter
Increments the counter for output requests by type, result, and delta.- Parameters:
type- the type of the requestresult- the result of the request, such as success or failuredelta- the value by which the counter should be increased
-
recordOutputBatchSize
void recordOutputBatchSize(MirroredSolrRequest.Type type, org.apache.solr.client.solrj.SolrRequest<?> solrRequest) Records the batch size of the output request. Batch size is defined as the number of operations in an outputSolrRequest(which may be different from the input size due to collapsing).- Parameters:
type- the type of the request, corresponding to one of theMirroredSolrRequest.getType()valuessolrRequest- SolrRequest object for which the batch size is being recorded
-
recordOutputBackoffTime
Records the backoff time for output requests. Backoff time represents the delay before the next retry for the specified request type.- Parameters:
type- the type of the request, corresponding to one of theMirroredSolrRequest.getType()values.backoffTimeMs- the backoff time in milliseconds.
-
recordOutputFirstAttemptTime
Records the latency between the time when the message was sent at source and the time of the first attempt at processing.- Parameters:
type- the type of the request, corresponding to one of theMirroredSolrRequest.getType()valuesfirstAttemptTimeMs- the latency of the first attempt in milliseconds.
-
startOutputTimeTimer
Starts a timer to measure the duration of an output request processing by the given request type.- Parameters:
requestType- the type of the request for which the timer is started- Returns:
- a
ConsumerMetrics.ConsumerTimerthat allows to measure the elapsed time
-