@@ -21,6 +21,7 @@ import {
2121} from './interfaces'
2222import * as logger from './logger'
2323import { log } from 'console'
24+ import { CHART_DEFAULTS } from './config'
2425
2526const STAT_SERVER_PORT = 7777
2627
@@ -60,16 +61,16 @@ async function reportWorkflowMetrics(): Promise<string> {
6061 const cpuLoad =
6162 userLoadX && userLoadX . length && systemLoadX && systemLoadX . length
6263 ? await getStackedAreaGraph ( {
63- label : 'CPU Load (%)' ,
64+ label : 'CPU load (%)' ,
6465 axisColor,
6566 areas : [
6667 {
67- label : 'User Load ' ,
68+ label : 'User load ' ,
6869 color : '#e41a1c99' ,
6970 points : userLoadX
7071 } ,
7172 {
72- label : 'System Load ' ,
73+ label : 'System load ' ,
7374 color : '#ff7f0099' ,
7475 points : systemLoadX
7576 }
@@ -83,7 +84,7 @@ async function reportWorkflowMetrics(): Promise<string> {
8384 availableMemoryX &&
8485 availableMemoryX . length
8586 ? await getStackedAreaGraph ( {
86- label : 'Memory Usage (MB)' ,
87+ label : 'Memory usage (MB)' ,
8788 axisColor,
8889 areas : [
8990 {
@@ -103,7 +104,7 @@ async function reportWorkflowMetrics(): Promise<string> {
103104 const networkIORead =
104105 networkReadX && networkReadX . length
105106 ? await getLineGraph ( {
106- label : 'Network I/O Read (MB)' ,
107+ label : 'Network I/O read (MB)' ,
107108 axisColor,
108109 line : {
109110 label : 'Read' ,
@@ -116,7 +117,7 @@ async function reportWorkflowMetrics(): Promise<string> {
116117 const networkIOWrite =
117118 networkWriteX && networkWriteX . length
118119 ? await getLineGraph ( {
119- label : 'Network I/O Write (MB)' ,
120+ label : 'Network I/O write (MB)' ,
120121 axisColor,
121122 line : {
122123 label : 'Write' ,
@@ -129,7 +130,7 @@ async function reportWorkflowMetrics(): Promise<string> {
129130 const diskIORead =
130131 diskReadX && diskReadX . length
131132 ? await getLineGraph ( {
132- label : 'Disk I/O Read (MB)' ,
133+ label : 'Disk I/O read (MB)' ,
133134 axisColor,
134135 line : {
135136 label : 'Read' ,
@@ -142,7 +143,7 @@ async function reportWorkflowMetrics(): Promise<string> {
142143 const diskIOWrite =
143144 diskWriteX && diskWriteX . length
144145 ? await getLineGraph ( {
145- label : 'Disk I/O Write (MB)' ,
146+ label : 'Disk I/O write (MB)' ,
146147 axisColor,
147148 line : {
148149 label : 'Write' ,
@@ -155,7 +156,7 @@ async function reportWorkflowMetrics(): Promise<string> {
155156 const diskSizeUsage =
156157 diskUsedX && diskUsedX . length && diskAvailableX && diskAvailableX . length
157158 ? await getStackedAreaGraph ( {
158- label : 'Disk Usage (MB)' ,
159+ label : 'Disk usage (MB)' ,
159160 axisColor,
160161 areas : [
161162 {
@@ -175,21 +176,21 @@ async function reportWorkflowMetrics(): Promise<string> {
175176 const postContentItems : string [ ] = [ ]
176177 if ( cpuLoad ) {
177178 postContentItems . push (
178- '### CPU Metrics ' ,
179+ '### CPU metrics ' ,
179180 `` ,
180181 ''
181182 )
182183 }
183184 if ( memoryUsage ) {
184185 postContentItems . push (
185- '### Memory Metrics ' ,
186+ '### Memory metrics ' ,
186187 `` ,
187188 ''
188189 )
189190 }
190191 if ( ( networkIORead && networkIOWrite ) || ( diskIORead && diskIOWrite ) ) {
191192 postContentItems . push (
192- '### IO Metrics ' ,
193+ '### IO metrics ' ,
193194 '| | Read | Write |' ,
194195 '|--- |--- |--- |'
195196 )
@@ -206,7 +207,7 @@ async function reportWorkflowMetrics(): Promise<string> {
206207 }
207208 if ( diskSizeUsage ) {
208209 postContentItems . push (
209- '### Disk Size Metrics ' ,
210+ '### Disk size metrics ' ,
210211 `` ,
211212 ''
212213 )
@@ -358,16 +359,10 @@ async function getDiskSizeStats(): Promise<ProcessedDiskSizeStats> {
358359async function getLineGraph ( options : LineGraphOptions ) : Promise < GraphResponse > {
359360 const payload = {
360361 options : {
361- width : 1000 ,
362- height : 500 ,
363- xAxis : {
364- label : 'Time'
365- } ,
362+ ...CHART_DEFAULTS . options ,
366363 yAxis : {
364+ ...CHART_DEFAULTS . options . yAxis ,
367365 label : options . label
368- } ,
369- timeTicks : {
370- unit : 'auto'
371366 }
372367 } ,
373368 lines : [ options . line ]
@@ -392,16 +387,10 @@ async function getStackedAreaGraph(
392387) : Promise < GraphResponse > {
393388 const payload = {
394389 options : {
395- width : 1000 ,
396- height : 500 ,
397- xAxis : {
398- label : 'Time'
399- } ,
390+ ...CHART_DEFAULTS . options ,
400391 yAxis : {
392+ ...CHART_DEFAULTS . options . yAxis ,
401393 label : options . label
402- } ,
403- timeTicks : {
404- unit : 'auto'
405394 }
406395 } ,
407396 areas : options . areas
0 commit comments