Package com.linkedin.venice.client.store
Class LoggingTrackingStoreClient<K,V>
java.lang.Object
com.linkedin.venice.client.store.InternalAvroStoreClient<K,V>
com.linkedin.venice.client.store.DelegatingStoreClient<K,V>
com.linkedin.venice.client.store.LoggingTrackingStoreClient<K,V>
- Type Parameters:
K- the type of keys used by the store clientV- the type of values returned by the store client
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,,V> AvroGenericStoreClient<K,,V> Closeable,AutoCloseable
- Direct Known Subclasses:
SpecificLoggingTrackingStoreClient
This class is a client wrapper that adds logging and tracking capabilities to store client operations.
The class is intended to be used when
ClientConfig.isStatTrackingEnabled() is set to false. It will try to
log exceptions and high latency requests with rate limiting. It is not intended to be used in production environments
where performance and metric monitoring is critical.
This class extends DelegatingStoreClient to encapsulate an internal store client and
override its key operations such as get, getRaw, batchGet, and
streamingBatchGet with additional logging and tracking functionality. It captures
the latency of operations and logs warnings when the latency exceeds predefined thresholds.
It also handles exceptions by logging unhealthy requests and rethrowing the exceptions for further handling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the values associated with the given keys and return them in a map of keys to values.voidcompute(ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) Forwards to the inner client'sget(K)rather than inheritingInternalAvroStoreClient.get(Object), so that inner decorators such asStatTrackingStoreClientstill record their single-get metrics.static <T> BiFunction<? super T,Throwable, ? extends T> getLoggingCallback(String storeName, long startTimeInNS) CompletableFuture<byte[]>Forwards to the inner client'sgetRaw(String)so that inner decorators such asStatTrackingStoreClientstill record their schema-reader metrics.static voidhandleStoreExceptionInternally(Throwable throwable) streamingBatchGet(Set<K> keys) Get the values associated with the given keys and return them in a map of keys to values.voidstreamingBatchGet(Set<K> keys, StreamingCallback<K, V> callback) Streaming interface forAvroGenericStoreClient.batchGet(Set).Methods inherited from class com.linkedin.venice.client.store.DelegatingStoreClient
close, compute, computeWithKeyPrefixFilter, get, getDeserializationExecutor, getInnerStoreClient, getKeySchema, getLatestValueSchema, getRaw, getSchemaReader, getStoreName, handlePreservingException, isProjectionFieldValidationEnabled, setClusterNameChangeListener, start, startWithExceptionThrownWhenFailMethods inherited from class com.linkedin.venice.client.store.InternalAvroStoreClient
getStreamingCallbackMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.client.store.AvroGenericReadComputeStoreClient
compute, compute, compute, computeAggregationMethods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
decompressAndDeserialize, get, registerStoreConfigChangeListener, registerVersionSwitchListener
-
Constructor Details
-
LoggingTrackingStoreClient
-
-
Method Details
-
get
Description copied from class:DelegatingStoreClientForwards to the inner client'sget(K)rather than inheritingInternalAvroStoreClient.get(Object), so that inner decorators such asStatTrackingStoreClientstill record their single-get metrics.- Specified by:
getin interfaceAvroGenericStoreClient<K,V> - Overrides:
getin classDelegatingStoreClient<K,V> - Returns:
-
getRaw
Description copied from class:DelegatingStoreClientForwards to the inner client'sgetRaw(String)so that inner decorators such asStatTrackingStoreClientstill record their schema-reader metrics.- Overrides:
getRawin classDelegatingStoreClient<K,V>
-
batchGet
Description copied from interface:AvroGenericStoreClientGet the values associated with the given keys and return them in a map of keys to values. Note that the returned map will only contain entries for the keys which have a value associated with them.- Specified by:
batchGetin interfaceAvroGenericStoreClient<K,V> - Overrides:
batchGetin classDelegatingStoreClient<K,V> - Returns:
- Throws:
VeniceClientException
-
streamingBatchGet
public void streamingBatchGet(Set<K> keys, StreamingCallback<K, V> callback) throws VeniceClientExceptionDescription copied from interface:AvroGenericStoreClientStreaming interface forAvroGenericStoreClient.batchGet(Set). You can find more info inStreamingCallback.- Specified by:
streamingBatchGetin interfaceAvroGenericStoreClient<K,V> - Overrides:
streamingBatchGetin classDelegatingStoreClient<K,V> - Throws:
VeniceClientException
-
streamingBatchGet
public CompletableFuture<VeniceResponseMap<K,V>> streamingBatchGet(Set<K> keys) throws VeniceClientException Description copied from interface:AvroGenericStoreClientGet the values associated with the given keys and return them in a map of keys to values. When time-out happens for the following invocation:streamingBatchGet(keys).get(waitingTime, unit);This function will return the available response instead of throwing aTimeoutException. It means this function could return either full response or partial response.- Returns:
- Throws:
VeniceClientException
-
compute
public void compute(ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException- Specified by:
computein interfaceAvroGenericReadComputeStoreClient<K,V> - Overrides:
computein classDelegatingStoreClient<K,V> - Throws:
VeniceClientException
-
getLoggingCallback
public static <T> BiFunction<? super T,Throwable, getLoggingCallback? extends T> (String storeName, long startTimeInNS) -
handleStoreExceptionInternally
-