Skip to content

Commit e4a1987

Browse files
Exporting two metrics using env vars - Noobaa_bucket_low_capacity_threshold and Noobaa_bucket_no_capacity_threshold
Signed-off-by: Aayush Chouhan <[email protected]>
1 parent 2a788fb commit e4a1987

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,10 @@ config.HA_METRICS_SERVER_PORT = 7003;
621621
config.EP_METRICS_SERVER_PORT = 7004;
622622
config.EP_METRICS_SERVER_SSL_PORT = 9443;
623623

624+
// Bucket capacity thresholds (percentage)
625+
config.BUCKET_LOW_CAPACITY_THRESHOLD = parseInt(process.env.BUCKET_LOW_CAPACITY_THRESHOLD, 10) || 80;
626+
config.BUCKET_NO_CAPACITY_THRESHOLD = parseInt(process.env.BUCKET_NO_CAPACITY_THRESHOLD, 10) || 95;
627+
624628
//////////////////////////////
625629
// OAUTH RELATES //
626630
//////////////////////////////
@@ -1118,6 +1122,7 @@ config.GPFS_DOWN_DELAY = 1000;
11181122

11191123
//Quota
11201124
config.QUOTA_LOW_THRESHOLD = 80;
1125+
11211126
config.QUOTA_MAX_OBJECTS = Number.MAX_SAFE_INTEGER;
11221127

11231128
//////////////////////////

src/server/analytic_services/prometheus_reports/noobaa_core_report.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,20 @@ const NOOBAA_CORE_METRICS = js_utils.deep_freeze([{
431431
help: 'Object Bucket Used Bytes',
432432
labelNames: ['bucket_name']
433433
}
434+
}, {
435+
type: 'Gauge',
436+
name: 'bucket_low_capacity_threshold',
437+
generate_default_set: true,
438+
configuration: {
439+
help: 'Bucket Low Capacity Threshold Percentage'
440+
}
441+
}, {
442+
type: 'Gauge',
443+
name: 'bucket_no_capacity_threshold',
444+
generate_default_set: true,
445+
configuration: {
446+
help: 'Bucket No Capacity Threshold Percentage'
447+
}
434448
}
435449
]);
436450

src/server/system_services/stats_aggregator.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,9 @@ function partial_cycle_parse_prometheus_metrics(payload) {
10651065
// TODO: Currently mock data, update with the relevant values.
10661066
core_report.set_rebuild_progress(100);
10671067
core_report.set_rebuild_time(0);
1068+
// set bucket capacity thresholds from config (env vars with defaults)
1069+
core_report.set_bucket_low_capacity_threshold(config.BUCKET_LOW_CAPACITY_THRESHOLD);
1070+
core_report.set_bucket_no_capacity_threshold(config.BUCKET_NO_CAPACITY_THRESHOLD);
10681071
}
10691072

10701073
/*

0 commit comments

Comments
 (0)