From 4c359c2a5f6331ea6dafd6f2684cbbf1a745f5e1 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sat, 29 Oct 2022 22:33:21 +0200 Subject: [PATCH] Integrate additional feedback for PR #200 --- deploy/grafana-dashboard/.gitignore | 2 +- deploy/grafana-dashboard/main.py | 4 +-- .../panels/availability_row.py | 15 ++++++----- .../grafana-dashboard/panels/general_row.py | 27 +++++++++++-------- .../panels/poseidon.dashboard.py | 6 ++--- .../panels/runner_insights_row.py | 26 +++++++++++------- deploy/grafana-dashboard/utils/utils.py | 3 +-- deploy/grafana-dashboard/utils/variables.py | 4 +-- 8 files changed, 51 insertions(+), 36 deletions(-) diff --git a/deploy/grafana-dashboard/.gitignore b/deploy/grafana-dashboard/.gitignore index 8a838aa..6381855 100644 --- a/deploy/grafana-dashboard/.gitignore +++ b/deploy/grafana-dashboard/.gitignore @@ -1,2 +1,2 @@ # Ignore the generated json encoded dashboard. -./main.json +main.json diff --git a/deploy/grafana-dashboard/main.py b/deploy/grafana-dashboard/main.py index d910d62..1b5fac1 100644 --- a/deploy/grafana-dashboard/main.py +++ b/deploy/grafana-dashboard/main.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 from grafanalib._gen import generate_dashboard -if __name__ == '__main__': - generate_dashboard(args=['-o', 'main.json', 'panels/poseidon.dashboard.py']) +if __name__ == "__main__": + generate_dashboard(args=["-o", "main.json", "panels/poseidon.dashboard.py"]) diff --git a/deploy/grafana-dashboard/panels/availability_row.py b/deploy/grafana-dashboard/panels/availability_row.py index 6f28527..65dd527 100644 --- a/deploy/grafana-dashboard/panels/availability_row.py +++ b/deploy/grafana-dashboard/panels/availability_row.py @@ -6,7 +6,7 @@ from utils.utils import read_query prewarming_pool_size = BarGauge( title="Prewarming Pool Size", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("prewarming-pool-size"))], gridPos=GridPos(h=10, w=11, x=0, y=1), allValues=True, @@ -17,27 +17,30 @@ prewarming_pool_size = BarGauge( idle_runner = TimeSeries( title="Idle Runner", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("idle-runner"))], gridPos=GridPos(h=10, w=13, x=11, y=1), lineInterpolation="stepAfter", - maxDataPoints=None + maxDataPoints=None, ) runner_startup_duration = TimeSeries( title="Runner startup duration", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("runner-startup-duration"))], gridPos=GridPos(h=10, w=12, x=0, y=11), unit="ns", + maxDataPoints=None, + lineInterpolation="smooth", ) used_runner = TimeSeries( title="Used Runner", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("used-runner"))], gridPos=GridPos(h=10, w=12, x=12, y=11), - maxDataPoints=None + maxDataPoints=None, + lineInterpolation="smooth", ) availability_row = RowPanel( diff --git a/deploy/grafana-dashboard/panels/general_row.py b/deploy/grafana-dashboard/panels/general_row.py index 19e2e80..143be34 100644 --- a/deploy/grafana-dashboard/panels/general_row.py +++ b/deploy/grafana-dashboard/panels/general_row.py @@ -7,16 +7,17 @@ from utils.utils import read_query requests_per_minute = TimeSeries( title="Requests per minute", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("requests-per-minute"))], gridPos=GridPos(h=9, w=8, x=0, y=22), scaleDistributionType="log", - extraJson=grey_all_mapping + extraJson=grey_all_mapping, + lineInterpolation="smooth", ) request_latency = Heatmap( title="Request Latency", - dataSource='Poseidon', + dataSource="Poseidon", dataFormat="timeseries", targets=[InfluxDBTarget(query=read_query("request-latency"))], gridPos=GridPos(h=9, w=8, x=8, y=22), @@ -26,34 +27,35 @@ request_latency = Heatmap( "yAxis": { "format": "ns" } - } + }, ) service_time = TimeSeries( title="Service time (99.9%)", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("service-time"))], gridPos=GridPos(h=9, w=8, x=16, y=22), scaleDistributionType="log", scaleDistributionLog=10, unit="ns", - maxDataPoints=None + maxDataPoints=None, + lineInterpolation="smooth", ) current_environment_count = Stat( title="Current environment count", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("current-environment-count"))], gridPos=GridPos(h=6, w=8, x=0, y=31), - alignment='center' + alignment="center", ) currently_used_runners = Stat( title="Currently used runners", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("currently-used-runners"))], gridPos=GridPos(h=6, w=8, x=8, y=31), - alignment="center" + alignment="center", ) number_of_executions = BarGauge( @@ -76,6 +78,7 @@ execution_duration = BarGauge( displayMode=GAUGE_DISPLAY_MODE_GRADIENT, format="ns", max=None, + decimals=2, ) executions_per_runner = BarGauge( @@ -86,6 +89,7 @@ executions_per_runner = BarGauge( allValues=True, displayMode=GAUGE_DISPLAY_MODE_GRADIENT, max=None, + decimals=2, ) executions_per_minute = BarGauge( @@ -96,6 +100,7 @@ executions_per_minute = BarGauge( allValues=True, displayMode=GAUGE_DISPLAY_MODE_GRADIENT, max=None, + decimals=2, ) general_row = RowPanel( @@ -114,5 +119,5 @@ general_panels = [ number_of_executions, execution_duration, executions_per_runner, - executions_per_minute + executions_per_minute, ] diff --git a/deploy/grafana-dashboard/panels/poseidon.dashboard.py b/deploy/grafana-dashboard/panels/poseidon.dashboard.py index 95b6f09..5a49677 100644 --- a/deploy/grafana-dashboard/panels/poseidon.dashboard.py +++ b/deploy/grafana-dashboard/panels/poseidon.dashboard.py @@ -11,11 +11,11 @@ dashboard = Dashboard( panels=availability_panels + general_panels + runner_insights_panels, templating=Templating(list=[ stage_variable, - environment_variable + environment_variable, ]), editable=True, refresh="30s", - time=Time('now-6h', 'now'), + time=Time("now-6h", "now"), uid="P21Bh1SVk", - version=1 + version=1, ).auto_panel_ids() diff --git a/deploy/grafana-dashboard/panels/runner_insights_row.py b/deploy/grafana-dashboard/panels/runner_insights_row.py index 4d56686..1eeee7d 100644 --- a/deploy/grafana-dashboard/panels/runner_insights_row.py +++ b/deploy/grafana-dashboard/panels/runner_insights_row.py @@ -12,48 +12,56 @@ execution_duration_extra_json = { } execution_duration = Histogram( title="Execution duration", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("execution-duration-hist"))], gridPos=GridPos(h=8, w=24, x=0, y=49), bucketSize=100000000, colorMode="palette-classic", + fillOpacity=50, + lineWidth=1, maxDataPoints=None, - extraJson=execution_duration_extra_json + extraJson=execution_duration_extra_json, ) executions_per_runner = Histogram( title="Executions per runner", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("executions-per-runner-hist"))], gridPos=GridPos(h=10, w=11, x=0, y=57), bucketSize=1, colorMode="palette-classic", + fillOpacity=50, + lineWidth=1, + maxDataPoints=None, ) executions_per_minute = TimeSeries( title="Executions per minute", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("executions-per-minute-time"))], gridPos=GridPos(h=10, w=13, x=11, y=57), - maxDataPoints=None + maxDataPoints=None, + lineInterpolation="smooth", ) request_body_size = TimeSeries( title="Request Body Size", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("request-body-size"))], gridPos=GridPos(h=10, w=11, x=0, y=67), scaleDistributionType="log", unit="bytes", - maxDataPoints=None + maxDataPoints=None, + lineInterpolation="smooth", ) runner_per_minute = TimeSeries( title="Runner per minute", - dataSource='Poseidon', + dataSource="Poseidon", targets=[InfluxDBTarget(query=read_query("runner-per-minute"))], gridPos=GridPos(h=10, w=13, x=11, y=67), - maxDataPoints=None + maxDataPoints=None, + lineInterpolation="smooth", ) runner_insights_row = RowPanel( diff --git a/deploy/grafana-dashboard/utils/utils.py b/deploy/grafana-dashboard/utils/utils.py index 38922b7..66daf0d 100644 --- a/deploy/grafana-dashboard/utils/utils.py +++ b/deploy/grafana-dashboard/utils/utils.py @@ -1,4 +1,3 @@ - def read_query(name): - with open("queries/" + name + ".flux", 'r') as file: + with open("queries/" + name + ".flux", "r") as file: return file.read() diff --git a/deploy/grafana-dashboard/utils/variables.py b/deploy/grafana-dashboard/utils/variables.py index a3c6573..266f8d2 100644 --- a/deploy/grafana-dashboard/utils/variables.py +++ b/deploy/grafana-dashboard/utils/variables.py @@ -10,7 +10,7 @@ stage_variable = Template( refresh=1, includeAll=True, multi=True, - default="production" + default="production", ) environment_variable = Template( @@ -21,5 +21,5 @@ environment_variable = Template( refresh=1, includeAll=True, multi=True, - default="$__all" + default="$__all", )