Class BaseRedisMetricsDatastore<SUPPLIER,MSG extends QueueMessage>
- java.lang.Object
-
- com.slack.api.rate_limits.metrics.impl.BaseRedisMetricsDatastore<SUPPLIER,MSG>
-
- All Implemented Interfaces:
MetricsDatastore
,AutoCloseable
- Direct Known Subclasses:
RedisMetricsDatastore
,RedisMetricsDatastore
,RedisMetricsDatastore
,RedisMetricsDatastore
public abstract class BaseRedisMetricsDatastore<SUPPLIER,MSG extends QueueMessage> extends Object implements MetricsDatastore, AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseRedisMetricsDatastore.MaintenanceJob
-
Field Summary
-
Fields inherited from interface com.slack.api.rate_limits.metrics.MetricsDatastore
DEFAULT_SINGLETON_EXECUTOR_NAME
-
-
Constructor Summary
Constructors Constructor Description BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool)
BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, boolean statsEnabled)
BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, boolean statsEnabled, long rateLimiterBackgroundJobIntervalMillis)
BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, ExecutorServiceProvider executorServiceProvider)
BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, ExecutorServiceProvider executorServiceProvider, boolean statsEnabled, long rateLimiterBackgroundJobIntervalMillis)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.slack.api.rate_limits.metrics.MetricsDatastore
getNumberOfNodes, getStats
-
-
-
-
Constructor Detail
-
BaseRedisMetricsDatastore
public BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool)
-
BaseRedisMetricsDatastore
public BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, ExecutorServiceProvider executorServiceProvider)
-
BaseRedisMetricsDatastore
public BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, boolean statsEnabled)
-
BaseRedisMetricsDatastore
public BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, boolean statsEnabled, long rateLimiterBackgroundJobIntervalMillis)
-
BaseRedisMetricsDatastore
public BaseRedisMetricsDatastore(String appName, redis.clients.jedis.JedisPool jedisPool, ExecutorServiceProvider executorServiceProvider, boolean statsEnabled, long rateLimiterBackgroundJobIntervalMillis)
-
-
Method Detail
-
getRateLimitQueue
public abstract RateLimitQueue<SUPPLIER,MSG> getRateLimitQueue(String executorName, String teamId)
-
jedis
public redis.clients.jedis.Jedis jedis()
-
initializeRateLimiterBackgroundJob
protected void initializeRateLimiterBackgroundJob()
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceMetricsDatastore
-
getMetricsType
protected abstract String getMetricsType()
-
getThreadGroupName
public String getThreadGroupName()
-
getExecutorServiceProvider
public ExecutorServiceProvider getExecutorServiceProvider()
- Specified by:
getExecutorServiceProvider
in interfaceMetricsDatastore
-
setExecutorServiceProvider
public void setExecutorServiceProvider(ExecutorServiceProvider executorServiceProvider)
- Specified by:
setExecutorServiceProvider
in interfaceMetricsDatastore
-
isTraceMode
public boolean isTraceMode()
- Specified by:
isTraceMode
in interfaceMetricsDatastore
-
setTraceMode
public void setTraceMode(boolean traceMode)
- Specified by:
setTraceMode
in interfaceMetricsDatastore
-
isStatsEnabled
public boolean isStatsEnabled()
- Specified by:
isStatsEnabled
in interfaceMetricsDatastore
-
setStatsEnabled
public void setStatsEnabled(boolean statsEnabled)
- Specified by:
setStatsEnabled
in interfaceMetricsDatastore
-
getRateLimiterBackgroundJobIntervalMillis
public long getRateLimiterBackgroundJobIntervalMillis()
- Specified by:
getRateLimiterBackgroundJobIntervalMillis
in interfaceMetricsDatastore
-
setRateLimiterBackgroundJobIntervalMillis
public void setRateLimiterBackgroundJobIntervalMillis(long rateLimiterBackgroundJobIntervalMillis)
- Specified by:
setRateLimiterBackgroundJobIntervalMillis
in interfaceMetricsDatastore
-
getAllStats
public Map<String,Map<String,RequestStats>> getAllStats()
- Specified by:
getAllStats
in interfaceMetricsDatastore
-
getStats
public RequestStats getStats(String executorName, String teamId)
- Specified by:
getStats
in interfaceMetricsDatastore
-
incrementAllCompletedCalls
public void incrementAllCompletedCalls(String executorName, String teamId, String methodName)
- Specified by:
incrementAllCompletedCalls
in interfaceMetricsDatastore
-
incrementSuccessfulCalls
public void incrementSuccessfulCalls(String executorName, String teamId, String methodName)
- Specified by:
incrementSuccessfulCalls
in interfaceMetricsDatastore
-
incrementUnsuccessfulCalls
public void incrementUnsuccessfulCalls(String executorName, String teamId, String methodName)
- Specified by:
incrementUnsuccessfulCalls
in interfaceMetricsDatastore
-
incrementFailedCalls
public void incrementFailedCalls(String executorName, String teamId, String methodName)
- Specified by:
incrementFailedCalls
in interfaceMetricsDatastore
-
updateCurrentQueueSize
public void updateCurrentQueueSize(String executorName, String teamId, String methodName)
- Specified by:
updateCurrentQueueSize
in interfaceMetricsDatastore
-
setCurrentQueueSize
public void setCurrentQueueSize(String executorName, String teamId, String methodName, Integer value)
- Specified by:
setCurrentQueueSize
in interfaceMetricsDatastore
-
updateNumberOfLastMinuteRequests
public void updateNumberOfLastMinuteRequests(String executorName, String teamId, String methodName)
- Specified by:
updateNumberOfLastMinuteRequests
in interfaceMetricsDatastore
-
getNumberOfLastMinuteRequests
public Integer getNumberOfLastMinuteRequests(String executorName, String teamId, String methodName)
- Specified by:
getNumberOfLastMinuteRequests
in interfaceMetricsDatastore
-
setNumberOfLastMinuteRequests
public void setNumberOfLastMinuteRequests(String executorName, String teamId, String methodName, Integer value)
- Specified by:
setNumberOfLastMinuteRequests
in interfaceMetricsDatastore
-
getRateLimitedMethodRetryEpochMillis
public Long getRateLimitedMethodRetryEpochMillis(String executorName, String teamId, String methodName)
- Specified by:
getRateLimitedMethodRetryEpochMillis
in interfaceMetricsDatastore
-
setRateLimitedMethodRetryEpochMillis
public void setRateLimitedMethodRetryEpochMillis(String executorName, String teamId, String methodName, Long epochTimeMillis)
- Specified by:
setRateLimitedMethodRetryEpochMillis
in interfaceMetricsDatastore
-
addToLastMinuteRequests
public void addToLastMinuteRequests(String executorName, String teamId, String methodName, Long currentMillis)
- Specified by:
addToLastMinuteRequests
in interfaceMetricsDatastore
-
getLastMinuteRequests
public LastMinuteRequests getLastMinuteRequests(String executorName, String teamId, String methodName)
- Specified by:
getLastMinuteRequests
in interfaceMetricsDatastore
-
addToWaitingMessageIds
public void addToWaitingMessageIds(String executorName, String teamId, String methodName, String messageId)
- Specified by:
addToWaitingMessageIds
in interfaceMetricsDatastore
-
deleteFromWaitingMessageIds
public void deleteFromWaitingMessageIds(String executorName, String teamId, String methodName, String messageId)
- Specified by:
deleteFromWaitingMessageIds
in interfaceMetricsDatastore
-
-