Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/api/stats_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ module.exports = {
},
is_healthy: {
type: 'boolean'
},
is_low_capacity: {
type: 'boolean'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ const NOOBAA_CORE_METRICS = js_utils.deep_freeze([{
help: 'Bucket Capacity Precent',
labelNames: ['bucket_name']
}
}, {
type: 'Gauge',
name: 'backing_store_low_capacity',
configuration: {
help: 'Does backing store in has low capacity',
labelNames: ['backing_store_name']
}
Comment on lines +297 to +303
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix grammatical error in help text.

The help text contains a grammatical error: "Does backing store in has low capacity" should be corrected to something clearer.

Apply this diff to improve the help text:

     }, {
         type: 'Gauge',
         name: 'backing_store_low_capacity',
         configuration: {
-            help: 'Does backing store in has low capacity',
+            help: 'Backing Store Low Capacity Status (0=normal, 1=low capacity)',
             labelNames: ['backing_store_name']
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
}, {
type: 'Gauge',
name: 'backing_store_low_capacity',
configuration: {
help: 'Does backing store in has low capacity',
labelNames: ['backing_store_name']
}
}, {
type: 'Gauge',
name: 'backing_store_low_capacity',
configuration: {
help: 'Backing Store Low Capacity Status (0=normal, 1=low capacity)',
labelNames: ['backing_store_name']
}
🤖 Prompt for AI Agents
In src/server/analytic_services/prometheus_reports/noobaa_core_report.js around
lines 297 to 303, the Gauge metric's help text is grammatically incorrect ("Does
backing store in has low capacity"); update the configuration.help string to a
clear, correct phrase such as "Indicates whether the backing store has low
capacity" (or "Backing store has low capacity") so the metric description reads
properly.

}, {
type: 'Gauge',
name: 'bucket_size_quota',
Expand Down Expand Up @@ -622,8 +629,12 @@ class NooBaaCoreReport extends BasePrometheusReport {
if (!this._metrics) return;

this._metrics.resource_status.reset();
this._metrics.backing_store_low_capacity.reset();
resources_info.forEach(resource_info => {
this._metrics.resource_status.set({ resource_name: resource_info.resource_name }, Number(resource_info.is_healthy));
this._metrics.backing_store_low_capacity.set(
{ backing_store_name: resource_info.resource_name },
Number(resource_info.is_low_capacity));
});
}

Expand Down
5 changes: 5 additions & 0 deletions src/server/system_services/stats_aggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,10 @@ async function get_cloud_pool_stats(req) {
'TIER_LOW_CAPACITY',
'LOW_CAPACITY',
];
const LOW_CAPACITY_MODES = [
'TIER_LOW_CAPACITY',
'LOW_CAPACITY',
];
//Per each system fill out the needed info
for (const pool of system_store.data.pools) {
if (pool.is_default_pool) continue;
Expand Down Expand Up @@ -794,6 +798,7 @@ async function get_cloud_pool_stats(req) {
cloud_pool_stats.resources.push({
resource_name: pool_info.name,
is_healthy: _.includes(OPTIMAL_MODES, pool_info.mode),
is_low_capacity: _.includes(LOW_CAPACITY_MODES, pool_info.mode),
});
}

Expand Down