add tenant kvcahe hold at SYSSTAT
This commit is contained in:
		
							
								
								
									
										10
									
								
								deps/oblib/src/lib/alloc/alloc_func.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								deps/oblib/src/lib/alloc/alloc_func.cpp
									
									
									
									
										vendored
									
									
								
							@ -86,6 +86,16 @@ int64_t get_tenant_memory_hold(const uint64_t tenant_id, const uint64_t ctx_id)
 | 
			
		||||
  return bytes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t get_tenant_cache_hold(uint64_t tenant_id)
 | 
			
		||||
{
 | 
			
		||||
  int64_t bytes = 0;
 | 
			
		||||
  ObMallocAllocator *allocator = ObMallocAllocator::get_instance();
 | 
			
		||||
  if (!OB_ISNULL(allocator)) {
 | 
			
		||||
    bytes = allocator->get_tenant_cache_hold(tenant_id);
 | 
			
		||||
  }
 | 
			
		||||
  return bytes;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t get_tenant_memory_remain(uint64_t tenant_id)
 | 
			
		||||
{
 | 
			
		||||
  int64_t bytes = 0;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								deps/oblib/src/lib/alloc/alloc_func.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								deps/oblib/src/lib/alloc/alloc_func.h
									
									
									
									
										vendored
									
									
								
							@ -36,6 +36,7 @@ void set_tenant_memory_limit(uint64_t tenant_id, int64_t bytes);
 | 
			
		||||
int64_t get_tenant_memory_limit(uint64_t tenant_id);
 | 
			
		||||
int64_t get_tenant_memory_hold(uint64_t tenant_id);
 | 
			
		||||
int64_t get_tenant_memory_hold(const uint64_t tenant_id, const uint64_t ctx_id);
 | 
			
		||||
int64_t get_tenant_cache_hold(uint64_t tenant_id);
 | 
			
		||||
int64_t get_tenant_memory_remain(uint64_t tenant_id);
 | 
			
		||||
void get_tenant_label_memory(
 | 
			
		||||
  uint64_t tenant_id, ObLabel &label, common::ObLabelItem &item);
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
									
									
									
									
										vendored
									
									
								
							@ -440,6 +440,16 @@ int64_t ObMallocAllocator::get_tenant_hold(uint64_t tenant_id)
 | 
			
		||||
  return hold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t ObMallocAllocator::get_tenant_cache_hold(uint64_t tenant_id)
 | 
			
		||||
{
 | 
			
		||||
  int64_t cache_hold = 0;
 | 
			
		||||
  with_resource_handle_invoke(tenant_id, [&cache_hold](ObTenantMemoryMgr *mgr) {
 | 
			
		||||
      cache_hold = mgr->get_cache_hold();
 | 
			
		||||
      return OB_SUCCESS;
 | 
			
		||||
    });
 | 
			
		||||
  return cache_hold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int64_t ObMallocAllocator::get_tenant_remain(uint64_t tenant_id)
 | 
			
		||||
{
 | 
			
		||||
  int64_t remain = 0;
 | 
			
		||||
 | 
			
		||||
@ -125,6 +125,7 @@ public:
 | 
			
		||||
  int set_tenant_limit(uint64_t tenant_id, int64_t bytes);
 | 
			
		||||
  int64_t get_tenant_limit(uint64_t tenant_id);
 | 
			
		||||
  int64_t get_tenant_hold(uint64_t tenant_id);
 | 
			
		||||
  int64_t get_tenant_cache_hold(uint64_t tenant_id);
 | 
			
		||||
  int64_t get_tenant_remain(uint64_t tenant_id);
 | 
			
		||||
  int64_t get_tenant_ctx_hold(const uint64_t tenant_id, const uint64_t ctx_id) const;
 | 
			
		||||
  void get_tenant_label_usage(uint64_t tenant_id, ObLabel &label, common::ObLabelItem &item) const;
 | 
			
		||||
 | 
			
		||||
@ -548,6 +548,7 @@ STAT_EVENT_SET_DEF(MEMORY_LIMIT, "effective observer memory limit", ObStatClassI
 | 
			
		||||
STAT_EVENT_SET_DEF(SYSTEM_MEMORY, "effective system memory", ObStatClassIds::RESOURCE, 140015, false, true, true)
 | 
			
		||||
STAT_EVENT_SET_DEF(HIDDEN_SYS_MEMORY, "effective hidden sys memory", ObStatClassIds::RESOURCE, 140016, false, true, true)
 | 
			
		||||
STAT_EVENT_SET_DEF(MAX_SESSION_NUM, "max session num", ObStatClassIds::RESOURCE, 140017, false, true, true)
 | 
			
		||||
STAT_EVENT_SET_DEF(KV_CACHE_HOLD, "kvcache hold", ObStatClassIds::RESOURCE, 140018, false, true, true)
 | 
			
		||||
 | 
			
		||||
//CLOG
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -208,6 +208,8 @@ int ObAllVirtualSysStat::update_all_stats_(const int64_t tenant_id, ObStatEventS
 | 
			
		||||
            = static_cast<int64_t>(cpu_usage * 100);
 | 
			
		||||
        stat_events.get(ObStatEventIds::MEMORY_USAGE - ObStatEventIds::STAT_EVENT_ADD_END -1)->stat_value_
 | 
			
		||||
            = lib::get_tenant_memory_hold(tenant_id);
 | 
			
		||||
        stat_events.get(ObStatEventIds::KV_CACHE_HOLD - ObStatEventIds::STAT_EVENT_ADD_END -1)->stat_value_
 | 
			
		||||
            = lib::get_tenant_cache_hold(tenant_id);
 | 
			
		||||
      } else {
 | 
			
		||||
        // it is ok to not have any records
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user