File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ public function onPhpbuEnd(End $event)
102102 $ this ->write ('# TYPE phpbu_backup_duration gauge ' . PHP_EOL );
103103 foreach ($ this ->backupStats as $ backupName => $ backupStats ) {
104104 $ duration = $ this ->backupStats [$ backupName ]['timeEnd ' ] - $ this ->backupStats [$ backupName ]['timeStart ' ];
105+ if ($ duration < 0 ) {
106+ $ duration = 0 ;
107+ }
105108 $ this ->write ('phpbu_backup_duration{name=" ' . $ backupName . '"} ' . $ duration . PHP_EOL );
106109 }
107110
@@ -124,7 +127,7 @@ public function onPhpbuEnd(End $event)
124127 foreach ($ this ->backupStats as $ backupName => $ backupStats ) {
125128 $ this ->write (
126129 'phpbu_backup_size{name=" ' . $ backupName . '"} ' .
127- $ this ->backupStats [$ backupName ]['size ' ] .
130+ ( $ this ->backupStats [$ backupName ]['size ' ] ?? " 0 " ) .
128131 PHP_EOL
129132 );
130133 }
You can’t perform that action at this time.
0 commit comments