show total disk usage for each app
This commit is contained in:
parent
6afefcec5b
commit
65e19d27e2
|
|
@ -13,6 +13,7 @@ const DATA_HISTORY_MAX_DAYS = 30 // Keep 30 days of data size history
|
||||||
const SAMPLE_INTERVAL_MS = 10_000 // How often to sample process metrics
|
const SAMPLE_INTERVAL_MS = 10_000 // How often to sample process metrics
|
||||||
const HISTORY_MAX_SAMPLES = 60 // Keep 10 minutes of history at 10s intervals
|
const HISTORY_MAX_SAMPLES = 60 // Keep 10 minutes of history at 10s intervals
|
||||||
|
|
||||||
|
const APPS_DIR = process.env.APPS_DIR!
|
||||||
const TOES_DIR = process.env.TOES_DIR!
|
const TOES_DIR = process.env.TOES_DIR!
|
||||||
const TOES_URL = process.env.TOES_URL!
|
const TOES_URL = process.env.TOES_URL!
|
||||||
|
|
||||||
|
|
@ -178,9 +179,12 @@ setInterval(sampleAndRecordHistory, SAMPLE_INTERVAL_MS)
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
function getDataSize(appName: string): number {
|
function getDataSize(appName: string): number {
|
||||||
|
let total = 0
|
||||||
|
const appDir = join(APPS_DIR, appName)
|
||||||
|
if (existsSync(appDir)) total += dirSize(appDir)
|
||||||
const dataDir = join(TOES_DIR, appName)
|
const dataDir = join(TOES_DIR, appName)
|
||||||
if (!existsSync(dataDir)) return 0
|
if (existsSync(dataDir)) total += dirSize(dataDir)
|
||||||
return dirSize(dataDir)
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
function dirSize(dir: string): number {
|
function dirSize(dir: string): number {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user