* [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta
@ 2020-11-10 9:18 Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-11-10 9:18 UTC (permalink / raw)
To: pbs-devel
so that we can show more info and calculate the points in time for the
history
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/api2/status.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/api2/status.rs b/src/api2/status.rs
index 582d7f0f..743b1355 100644
--- a/src/api2/status.rs
+++ b/src/api2/status.rs
@@ -103,6 +103,7 @@ fn datastore_status(
"total": status.total,
"used": status.used,
"avail": status.avail,
+ "gc-status": datastore.last_gc_status(),
});
let rrd_dir = format!("datastore/{}", store);
@@ -152,6 +153,8 @@ fn datastore_status(
}
}
+ entry["history-start"] = start.into();
+ entry["history-delta"] = reso.into();
entry["history"] = history.into();
// we skip the calculation for datastores with not enough data
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
@ 2020-11-10 9:18 ` Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor Dominik Csapak
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-11-10 9:18 UTC (permalink / raw)
To: pbs-devel
heavily inspired by pveRunningChart, without the dynamically adding
of data and specific for the usage of datastores
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/Makefile | 1 +
www/panel/UsageChart.js | 115 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+)
create mode 100644 www/panel/UsageChart.js
diff --git a/www/Makefile b/www/Makefile
index bfea32fa..f64d2bba 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -44,6 +44,7 @@ JSSRC= \
panel/XtermJsConsole.js \
panel/AccessControl.js \
panel/StorageAndDisks.js \
+ panel/UsageChart.js \
ZFSList.js \
DirectoryList.js \
LoginView.js \
diff --git a/www/panel/UsageChart.js b/www/panel/UsageChart.js
new file mode 100644
index 00000000..87f1200d
--- /dev/null
+++ b/www/panel/UsageChart.js
@@ -0,0 +1,115 @@
+Ext.define('PBS.widget.UsageChart', {
+ extend: 'Ext.container.Container',
+ alias: 'widget.pbsUsageChart',
+
+ layout: {
+ type: 'hbox',
+ align: 'center',
+ },
+
+ items: [
+ {
+ width: 80,
+ xtype: 'box',
+ itemId: 'title',
+ data: {
+ title: '',
+ },
+ tpl: '<h3>{title}:</h3>',
+ },
+ {
+ flex: 1,
+ xtype: 'cartesian',
+ height: '100%',
+ itemId: 'chart',
+ border: false,
+ axes: [
+ {
+ type: 'numeric',
+ position: 'right',
+ hidden: true,
+ minimum: 0,
+ },
+ {
+ type: 'time',
+ position: 'bottom',
+ hidden: true,
+ },
+ ],
+
+ store: {
+ trackRemoved: false,
+ data: {},
+ },
+
+ series: [{
+ type: 'line',
+ xField: 'time',
+ yField: 'val',
+ fill: 'true',
+ colors: ['#cfcfcf'],
+ tooltip: {
+ trackMouse: true,
+ renderer: function(tooltip, record, ctx) {
+ if (!record || !record.data) return;
+ let date = new Date(record.data.time);
+ let value = (100*record.data.val).toFixed(2);
+ tooltip.setHtml(
+ `${value} %<br />
+ ${date}`,
+ );
+ },
+ },
+ style: {
+ lineWidth: 1.5,
+ opacity: 0.60,
+ },
+ marker: {
+ opacity: 0,
+ scaling: 0.01,
+ fx: {
+ duration: 200,
+ easing: 'easeOut',
+ },
+ },
+ highlightCfg: {
+ opacity: 1,
+ scaling: 1.5,
+ },
+ }],
+ },
+ ],
+
+ setData: function(data) {
+ let me = this;
+ let chart = me.chart;
+ chart.store.setData(data);
+ chart.redraw();
+ },
+
+ // the renderer for the tooltip and last value, default just the value
+ renderer: Ext.identityFn,
+
+ setTitle: function(title) {
+ let me = this;
+ me.title = title;
+ me.getComponent('title').update({ title: title });
+ },
+
+ initComponent: function() {
+ var me = this;
+ me.callParent();
+
+ if (me.title) {
+ me.getComponent('title').update({ title: me.title });
+ }
+ me.chart = me.getComponent('chart');
+ me.chart.timeaxis = me.chart.getAxes()[1];
+ if (me.color) {
+ me.chart.series[0].setStyle({
+ fill: me.color,
+ stroke: me.color,
+ });
+ }
+ },
+});
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
@ 2020-11-10 9:18 ` Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart Dominik Csapak
2020-11-10 10:47 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-11-10 9:18 UTC (permalink / raw)
To: pbs-devel
so that we can reuse this
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/Utils.js | 8 ++++++++
www/datastore/Summary.js | 5 +----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index 2d0993a3..f678a916 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -247,6 +247,14 @@ Ext.define('PBS.Utils', {
};
},
+ calculate_dedup_factor: function(gcstatus) {
+ let dedup = 1.0;
+ if (gcstatus['disk-bytes'] > 0) {
+ dedup = (gcstatus['index-data-bytes'] || 0)/gcstatus['disk-bytes'];
+ }
+ return dedup;
+ },
+
constructor: function() {
var me = this;
diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index ac3f19e2..5c757e8c 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -57,10 +57,7 @@ Ext.define('PBS.DataStoreInfo', {
let gcstatus = store.getById('gc-status').data.value;
- let dedup = 1.0;
- if (gcstatus['disk-bytes'] > 0) {
- dedup = (gcstatus['index-data-bytes'] || 0)/gcstatus['disk-bytes'];
- }
+ let dedup = PBS.Utils.calculate_dedup_factor(gcstatus);
let countstext = function(count) {
count = count || {};
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor Dominik Csapak
@ 2020-11-10 9:18 ` Dominik Csapak
2020-11-10 10:47 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2020-11-10 9:18 UTC (permalink / raw)
To: pbs-devel
changes the layout to look i little bit more like the statistics panel
we have for ceph in pve, while changing to the UsageChart and adding
some more datastore infos (from last garbage collect)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
www/datastore/DataStoreListSummary.js | 128 ++++++++++++--------------
1 file changed, 61 insertions(+), 67 deletions(-)
diff --git a/www/datastore/DataStoreListSummary.js b/www/datastore/DataStoreListSummary.js
index 67d01e16..778bbac8 100644
--- a/www/datastore/DataStoreListSummary.js
+++ b/www/datastore/DataStoreListSummary.js
@@ -7,21 +7,20 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
cbind: {
title: '{datastore}',
},
+
+ referenceHolder: true,
bodyPadding: 10,
- controller: {
- xclass: 'Ext.app.ViewController',
+ layout: {
+ type: 'hbox',
+ align: 'stretch',
},
+
viewModel: {
data: {
full: "N/A",
- history: [],
- },
-
- stores: {
- historystore: {
- data: [],
- },
+ stillbad: 0,
+ deduplication: 1.0,
},
},
setTasks: function(taskdata, since) {
@@ -44,46 +43,53 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
let estimate = PBS.Utils.render_estimate(statusData['estimated-full-date']);
vm.set('full', estimate);
+ vm.set('deduplication', PBS.Utils.calculate_dedup_factor(statusData['gc-status']).toFixed(2));
+ vm.set('stillbad', statusData['gc-status']['still-bad']);
+
let last = 0;
+ let time = statusData['history-start'];
+ let delta = statusData['history-delta'];
let data = statusData.history.map((val) => {
if (val === null) {
val = last;
} else {
last = val;
}
- return val;
+ let entry = {
+ time: time*1000, // js Dates are ms since epoch
+ val,
+ };
+
+ time += delta;
+ return entry;
});
- let historyStore = vm.getStore('historystore');
- historyStore.setData([
- {
- history: data,
- },
- ]);
+
+ me.lookup('historychart').setData(data);
},
items: [
{
xtype: 'container',
layout: {
- type: 'hbox',
+ type: 'vbox',
align: 'stretch',
},
- defaults: {
- padding: 5,
- },
+ width: 350,
+ padding: 10,
items: [
{
- xtype: 'panel',
- border: false,
+ xtype: 'proxmoxGauge',
+ warningThreshold: 0.8,
+ criticalThreshold: 0.95,
flex: 1,
+ reference: 'usage',
},
{
xtype: 'pmxInfoWidget',
iconCls: 'fa fa-fw fa-line-chart',
title: gettext('Estimated Full'),
- width: 230,
printBar: false,
bind: {
data: {
@@ -91,64 +97,52 @@ Ext.define('PBS.datastore.DataStoreListSummary', {
},
},
},
- ],
- },
- {
- // we cannot autosize a sparklineline widget,
- // abuse a grid with a single column/row to do it for us
- xtype: 'grid',
- hideHeaders: true,
- minHeight: 70,
- border: false,
- bodyBorder: false,
- rowLines: false,
- disableSelection: true,
- viewConfig: {
- trackOver: false,
- },
- bind: {
- store: '{historystore}',
- },
- columns: [{
- xtype: 'widgetcolumn',
- flex: 1,
- dataIndex: 'history',
- widget: {
- xtype: 'sparklineline',
- bind: '{record.history}',
- spotRadius: 0,
- fillColor: '#ddd',
- lineColor: '#555',
- lineWidth: 0,
- chartRangeMin: 0,
- chartRangeMax: 1,
- tipTpl: '{y:number("0.00")*100}%',
- height: 60,
+ {
+ xtype: 'pmxInfoWidget',
+ iconCls: 'fa fa-fw fa-compress',
+ title: gettext('Deduplication Factor'),
+ printBar: false,
+ bind: {
+ data: {
+ text: '{deduplication}',
+ },
+ },
},
- }],
+ {
+ xtype: 'pmxInfoWidget',
+ iconCls: 'fa critical fa-fw fa-exclamation-triangle',
+ title: gettext('Bad Chunks'),
+ printBar: false,
+ hidden: true,
+ bind: {
+ data: {
+ text: '{stillbad}',
+ },
+ visible: '{stillbad}',
+ },
+ },
+ ],
},
{
xtype: 'container',
layout: {
- type: 'hbox',
+ type: 'vbox',
align: 'stretch',
},
- defaults: {
- padding: 5,
- },
+ flex: 1,
items: [
{
- xtype: 'proxmoxGauge',
- warningThreshold: 0.8,
- criticalThreshold: 0.95,
- flex: 1,
- reference: 'usage',
+ padding: 5,
+ xtype: 'pbsUsageChart',
+ reference: 'historychart',
+ title: gettext('Usage History'),
+ height: 100,
},
{
xtype: 'container',
- flex: 2,
+ flex: 1,
layout: {
type: 'vbox',
align: 'stretch',
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
` (2 preceding siblings ...)
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart Dominik Csapak
@ 2020-11-10 10:47 ` Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2020-11-10 10:47 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Dominik Csapak
On 10.11.20 10:18, Dominik Csapak wrote:
> so that we can show more info and calculate the points in time for the
> history
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/api2/status.rs | 3 +++
> 1 file changed, 3 insertions(+)
>
>
applied series, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-10 10:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 9:18 [pbs-devel] [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] ui: add panel/UsageChart Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 3/4] ui: refactor calculate_dedup_factor Dominik Csapak
2020-11-10 9:18 ` [pbs-devel] [PATCH proxmox-backup 4/4] ui: Datastores Summary: change layout and chart Dominik Csapak
2020-11-10 10:47 ` [pbs-devel] applied-series: [PATCH proxmox-backup 1/4] api2/status/datastore-usage: add gc-status and history start and delta Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox