mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat(server): Return per-type memory breakdown from INFO and /metrics (#2262)
* feat(server): Return per-type memory breakdown from INFO and /metrics * OBJ_TYPE_MAX * Move AddTypeMemoryUsage, use it from TieredStorage * Remove strval_memory_usage * Remove redundant strval_bytes --------- Signed-off-by: Shahar Mike <chakaz@users.noreply.github.com>
This commit is contained in:
parent
be82c11428
commit
636507c356
9 changed files with 95 additions and 22 deletions
|
@ -18,6 +18,7 @@ extern "C" {
|
|||
#include "redis/zset.h"
|
||||
}
|
||||
#include <absl/strings/str_cat.h>
|
||||
#include <absl/strings/strip.h>
|
||||
|
||||
#include <jsoncons/json.hpp>
|
||||
|
||||
|
@ -649,6 +650,28 @@ unsigned CompactObj::ObjType() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
string_view CompactObj::ObjTypeToString(unsigned type) {
|
||||
#define OBJECT_TYPE_CASE(type) \
|
||||
case type: \
|
||||
return absl::StripPrefix(#type, "OBJ_")
|
||||
|
||||
switch (type) {
|
||||
OBJECT_TYPE_CASE(OBJ_STRING);
|
||||
OBJECT_TYPE_CASE(OBJ_LIST);
|
||||
OBJECT_TYPE_CASE(OBJ_SET);
|
||||
OBJECT_TYPE_CASE(OBJ_ZSET);
|
||||
OBJECT_TYPE_CASE(OBJ_HASH);
|
||||
OBJECT_TYPE_CASE(OBJ_MODULE);
|
||||
OBJECT_TYPE_CASE(OBJ_STREAM);
|
||||
OBJECT_TYPE_CASE(OBJ_JSON);
|
||||
default:
|
||||
DCHECK(false) << "Unknown object type " << type;
|
||||
return "OTHER";
|
||||
}
|
||||
|
||||
#undef OBJECT_TYPE_CASE
|
||||
}
|
||||
|
||||
unsigned CompactObj::Encoding() const {
|
||||
switch (taglen_) {
|
||||
case ROBJ_TAG:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue