diff options
| author | chenzizhan <[email protected]> | 2024-07-18 17:33:56 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-07-18 17:33:56 +0800 |
| commit | 5f25467142e9bf1dfae083edcd4dc29195105b1b (patch) | |
| tree | c067d253f71ff0e7986a219dad2b61f79a694bde /src | |
| parent | 36282ca44af142f5f1900342ea5e2d5ac1fc34e2 (diff) | |
fix deserialize
Diffstat (limited to 'src')
| -rw-r--r-- | src/cells/spread_sketch.c | 8 | ||||
| -rw-r--r-- | src/exporter/shaping_global_stat.json | 82 |
2 files changed, 85 insertions, 5 deletions
diff --git a/src/cells/spread_sketch.c b/src/cells/spread_sketch.c index 4746170..1d684cb 100644 --- a/src/cells/spread_sketch.c +++ b/src/cells/spread_sketch.c @@ -12,11 +12,6 @@ #include "hll_common.h" #include "exdata.h" - -// TODO: 适配swarm kv 时的问题: -// 需要返回一个double,正常spread sketch 一定返回值(key 不在也更新hll),所以这里的查询怎么样比较好? - - struct entry { int ref_count; void *exdata; @@ -673,6 +668,9 @@ struct spread_sketch *spread_sketch_deserialize(const char *blob, size_t blob_sz int64_t key_len; memcpy(&key_len, blob, sizeof(int64_t)); blob += sizeof(int64_t); + if (key_len == 0) { + continue; + } const char *key = blob; blob += key_len; diff --git a/src/exporter/shaping_global_stat.json b/src/exporter/shaping_global_stat.json new file mode 100644 index 0000000..4e7250c --- /dev/null +++ b/src/exporter/shaping_global_stat.json @@ -0,0 +1,82 @@ +[ + { + "name": "shaping_global", + "tags": { + "hahah": 1 + }, + "fields": { + "curr_session_num": 0, + "curr_queueing_pkts": 0, + "curr_queueing_bytes": 0, + "ctrl_error": 0, + "ctrl_open": 0, + "ctrl_active": 0, + "ctrl_close": 0, + "ctrl_sf_close": 0, + "ctrl_reset": 0, + "sess_log_send": 0, + "async": 0, + "async_cb": 0, + "tconsume": 0, + "tconsume_cb": 0, + "hincrby": 0, + "hincrby_cb": 0, + "hmget": 0, + "hmget_cb": 0, + "tconsume_failed": 0, + "hincrby_failed": 0, + "hmget_failed": 0, + "all_rx_pkts": 6676, + "all_rx_bytes": 146872, + "all_tx_pkts": 6676, + "all_tx_bytes": 146872, + "all_drop_pkts": 0, + "all_drop_bytes": 0, + "shape_rx_pkts": 0, + "shape_rx_bytes": 0, + "shape_tx_pkts": 0, + "shape_tx_bytes": 0, + "shape_tx_syn_ack_pkts": 0, + "shape_drop_pkts": 0, + "shape_drop_bytes": 0 + }, + "fields_delta": { + "curr_session_num": 0, + "curr_queueing_pkts": 0, + "curr_queueing_bytes": 0, + "ctrl_error": 0, + "ctrl_open": 0, + "ctrl_active": 0, + "ctrl_close": 0, + "ctrl_sf_close": 0, + "ctrl_reset": 0, + "sess_log_send": 0, + "async": 0, + "async_cb": 0, + "tconsume": 0, + "tconsume_cb": 0, + "hincrby": 0, + "hincrby_cb": 0, + "hmget": 0, + "hmget_cb": 0, + "tconsume_failed": 0, + "hincrby_failed": 0, + "hmget_failed": 0, + "all_rx_pkts": 100, + "all_rx_bytes": 2200, + "all_tx_pkts": 100, + "all_tx_bytes": 2200, + "all_drop_pkts": 0, + "all_drop_bytes": 0, + "shape_rx_pkts": 0, + "shape_rx_bytes": 0, + "shape_tx_pkts": 0, + "shape_tx_bytes": 0, + "shape_tx_syn_ack_pkts": 0, + "shape_drop_pkts": 0, + "shape_drop_bytes": 0 + }, + "timestamp_ms": 1721294421351, + "timestamp_ms_delta": 1002 + } +]
\ No newline at end of file |
