Merge pull request #8837 from sfc-gh-akejriwal/monitorusage
Add a TraceEvent to export the size of tenant groups
This commit is contained in:
commit
3e5cad1508
|
@ -301,6 +301,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( TENANT_CACHE_LIST_REFRESH_INTERVAL, 2 ); if( randomize && BUGGIFY ) TENANT_CACHE_LIST_REFRESH_INTERVAL = deterministicRandom()->randomInt(1, 10);
|
||||
init( TENANT_CACHE_STORAGE_USAGE_REFRESH_INTERVAL, 2 ); if( randomize && BUGGIFY ) TENANT_CACHE_STORAGE_USAGE_REFRESH_INTERVAL = deterministicRandom()->randomInt(1, 10);
|
||||
init( TENANT_CACHE_STORAGE_QUOTA_REFRESH_INTERVAL, 10 ); if( randomize && BUGGIFY ) TENANT_CACHE_STORAGE_QUOTA_REFRESH_INTERVAL = deterministicRandom()->randomInt(1, 10);
|
||||
init( TENANT_CACHE_STORAGE_USAGE_TRACE_INTERVAL, 300 );
|
||||
init( CP_FETCH_TENANTS_OVER_STORAGE_QUOTA_INTERVAL, 5 ); if( randomize && BUGGIFY ) CP_FETCH_TENANTS_OVER_STORAGE_QUOTA_INTERVAL = deterministicRandom()->randomInt(1, 10);
|
||||
|
||||
// TeamRemover
|
||||
|
|
|
@ -244,6 +244,8 @@ public:
|
|||
// in the TenantCache
|
||||
int TENANT_CACHE_STORAGE_QUOTA_REFRESH_INTERVAL; // How often the storage quota allocated to each tenant is
|
||||
// refreshed in the TenantCache
|
||||
int TENANT_CACHE_STORAGE_USAGE_TRACE_INTERVAL; // The minimum interval between consecutive trace events logging the
|
||||
// storage bytes used by a tenant group
|
||||
int CP_FETCH_TENANTS_OVER_STORAGE_QUOTA_INTERVAL; // How often the commit proxies send requests to the data
|
||||
// distributor to fetch the list of tenants over storage quota
|
||||
|
||||
|
|
|
@ -124,9 +124,17 @@ public:
|
|||
|
||||
state int refreshInterval = SERVER_KNOBS->TENANT_CACHE_STORAGE_USAGE_REFRESH_INTERVAL;
|
||||
state double lastTenantListFetchTime = now();
|
||||
state double lastTraceTime = 0;
|
||||
|
||||
loop {
|
||||
state double fetchStartTime = now();
|
||||
|
||||
state bool toTrace = false;
|
||||
if (fetchStartTime - lastTraceTime > SERVER_KNOBS->TENANT_CACHE_STORAGE_USAGE_TRACE_INTERVAL) {
|
||||
toTrace = true;
|
||||
lastTraceTime = fetchStartTime;
|
||||
}
|
||||
|
||||
state std::vector<TenantGroupName> groups;
|
||||
for (const auto& [group, storage] : tenantCache->tenantStorageMap) {
|
||||
groups.push_back(group);
|
||||
|
@ -159,6 +167,14 @@ public:
|
|||
}
|
||||
}
|
||||
tenantCache->tenantStorageMap[group].usage = usage;
|
||||
|
||||
if (toTrace) {
|
||||
// Trace the storage used by all tenant groups for visibility.
|
||||
TraceEvent(SevInfo, "StorageUsageUpdated", tenantCache->id())
|
||||
.detail("TenantGroup", group)
|
||||
.detail("Quota", tenantCache->tenantStorageMap[group].quota)
|
||||
.detail("Usage", tenantCache->tenantStorageMap[group].usage);
|
||||
}
|
||||
}
|
||||
|
||||
lastTenantListFetchTime = now();
|
||||
|
|
Loading…
Reference in New Issue