public class ClientStatsUtil extends Object
Stats calculations needed by storm client code.
Modifier and Type | Field and Description |
---|---|
static String |
BOLT |
static org.apache.storm.stats.ClientStatsUtil.IdentityTransformer |
IDENTITY |
static String |
SPOUT |
static String |
TIME_SECS |
static org.apache.storm.stats.ClientStatsUtil.ToGlobalStreamIdTransformer |
TO_GSID |
Constructor and Description |
---|
ClientStatsUtil() |
Modifier and Type | Method and Description |
---|---|
static List<Integer> |
convertExecutor(List<Long> executor)
Convert a List<Long> executor to java List<Integer>.
|
static Map<List<Integer>,ExecutorStats> |
convertExecutorZkHbs(Map<List<Long>,ExecutorStats> executorBeats)
Convert Long Executor Ids in ZkHbs to Integer ones structure to java maps.
|
static <K,V> Map<K,V> |
getMapByKey(Map map,
String key)
Get a sub-map by a given key.
|
static Map<List<Integer>,ExecutorStats> |
mkEmptyExecutorZkHbs(Set<List<Long>> executors)
Make an map of executors to empty stats, in preparation for doing a heartbeat.
|
static Map<String,Object> |
mkZkWorkerHb(String topoId,
Map<List<Integer>,ExecutorStats> executorStats,
Integer uptime)
Create a new worker heartbeat for zookeeper.
|
static ClusterWorkerHeartbeat |
thriftifyZkWorkerHb(Map<String,Object> heartbeat) |
static <K1,K2> Map |
windowSetConverter(Map stats,
org.apache.storm.stats.ClientStatsUtil.KeyTransformer<K2> secKeyFunc,
org.apache.storm.stats.ClientStatsUtil.KeyTransformer<K1> firstKeyFunc)
Converts stats to be over given windows of time.
|
public static final String SPOUT
public static final String BOLT
public static final String TIME_SECS
public static final org.apache.storm.stats.ClientStatsUtil.ToGlobalStreamIdTransformer TO_GSID
public static final org.apache.storm.stats.ClientStatsUtil.IdentityTransformer IDENTITY
public static List<Integer> convertExecutor(List<Long> executor)
Convert a List<Long> executor to java List<Integer>.
public static Map<List<Integer>,ExecutorStats> mkEmptyExecutorZkHbs(Set<List<Long>> executors)
Make an map of executors to empty stats, in preparation for doing a heartbeat.
executors
- the executors as keys of the mappublic static Map<List<Integer>,ExecutorStats> convertExecutorZkHbs(Map<List<Long>,ExecutorStats> executorBeats)
Convert Long Executor Ids in ZkHbs to Integer ones structure to java maps.
public static Map<String,Object> mkZkWorkerHb(String topoId, Map<List<Integer>,ExecutorStats> executorStats, Integer uptime)
Create a new worker heartbeat for zookeeper.
topoId
- the topology idexecutorStats
- the stats for the executorsuptime
- the uptime for the workerpublic static <K,V> Map<K,V> getMapByKey(Map map, String key)
Get a sub-map by a given key.
map
- the original mapkey
- the key to get it frompublic static ClusterWorkerHeartbeat thriftifyZkWorkerHb(Map<String,Object> heartbeat)
public static <K1,K2> Map windowSetConverter(Map stats, org.apache.storm.stats.ClientStatsUtil.KeyTransformer<K2> secKeyFunc, org.apache.storm.stats.ClientStatsUtil.KeyTransformer<K1> firstKeyFunc)
Converts stats to be over given windows of time.
stats
- the statssecKeyFunc
- transform the sub-keyfirstKeyFunc
- transform the main keyCopyright © 2022 The Apache Software Foundation. All rights reserved.