Add panels visualizing the file download.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from grafanalib.core import RowPanel, GridPos, Histogram, TimeSeries
|
||||
from grafanalib.core import RowPanel, GridPos, Histogram, TimeSeries, BarGauge, ORIENTATION_VERTICAL, \
|
||||
GAUGE_DISPLAY_MODE_BASIC, PERCENT_UNIT_FORMAT, GAUGE_CALC_MEAN
|
||||
from grafanalib.influxdb import InfluxDBTarget
|
||||
|
||||
from utils.color_mapping import color_mapping_environments
|
||||
@ -48,10 +49,10 @@ executions_per_minute = TimeSeries(
|
||||
extraJson=color_mapping_environments,
|
||||
)
|
||||
|
||||
request_body_size = TimeSeries(
|
||||
title="Request Body Size",
|
||||
file_upload = TimeSeries(
|
||||
title="File Upload",
|
||||
dataSource="Poseidon",
|
||||
targets=[InfluxDBTarget(query=read_query("request-body-size", "environment-mapping"))],
|
||||
targets=[InfluxDBTarget(query=read_query("file-upload", "environment-mapping"))],
|
||||
gridPos=GridPos(h=10, w=11, x=0, y=67),
|
||||
scaleDistributionType="log",
|
||||
unit="bytes",
|
||||
@ -70,6 +71,32 @@ runner_per_minute = TimeSeries(
|
||||
extraJson=color_mapping_environments,
|
||||
)
|
||||
|
||||
file_download = TimeSeries(
|
||||
title="File Download",
|
||||
dataSource="Poseidon",
|
||||
targets=[InfluxDBTarget(query=read_query("file-download", "environment-mapping"))],
|
||||
gridPos=GridPos(h=10, w=11, x=0, y=77),
|
||||
scaleDistributionType="log",
|
||||
unit="bytes",
|
||||
maxDataPoints=None,
|
||||
lineInterpolation="smooth",
|
||||
extraJson=color_mapping_environments,
|
||||
)
|
||||
|
||||
file_download_ratio = BarGauge(
|
||||
title="File Download Ratio",
|
||||
dataSource="Poseidon",
|
||||
targets=[InfluxDBTarget(query=read_query("file-download-ratio", "environment-mapping"))],
|
||||
gridPos=GridPos(h=10, w=13, x=11, y=77),
|
||||
max=1,
|
||||
allValues=False,
|
||||
calc=GAUGE_CALC_MEAN,
|
||||
orientation=ORIENTATION_VERTICAL,
|
||||
displayMode=GAUGE_DISPLAY_MODE_BASIC,
|
||||
format=PERCENT_UNIT_FORMAT,
|
||||
extraJson=color_mapping_environments,
|
||||
)
|
||||
|
||||
runner_insights_row = RowPanel(
|
||||
title="Runner Insights",
|
||||
collapsed=False,
|
||||
@ -81,6 +108,8 @@ runner_insights_panels = [
|
||||
execution_duration,
|
||||
executions_per_runner,
|
||||
executions_per_minute,
|
||||
request_body_size,
|
||||
file_upload,
|
||||
runner_per_minute,
|
||||
file_download,
|
||||
file_download_ratio,
|
||||
]
|
||||
|
13
deploy/grafana-dashboard/queries/file-download-ratio.flux
Normal file
13
deploy/grafana-dashboard/queries/file-download-ratio.flux
Normal file
@ -0,0 +1,13 @@
|
||||
import "strings"
|
||||
|
||||
myWindowPeriod = if int(v: v.windowPeriod) > int(v: 1m) then duration(v: int(v: v.windowPeriod) * 10) else duration(v: int(v: v.windowPeriod) * 5)
|
||||
data = from(bucket: "poseidon/autogen")
|
||||
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
||||
|> filter(fn: (r) => r["_measurement"] == "poseidon_file_download")
|
||||
|> filter(fn: (r) => contains(value: r["environment_id"], set: ${environment_ids:json}))
|
||||
|> filter(fn: (r) => (not exists r.stage) or contains(value: r["stage"], set: ${stages:json}))
|
||||
|
||||
actual = data |> filter(fn: (r) => r["_field"] == "actual_length")
|
||||
expected = data |> filter(fn: (r) => r["_field"] == "expected_length")
|
||||
result = join(tables: {key1: actual, key2: expected}, on: ["_time", "environment_id", "runner_id", "stage"], method: "inner")
|
||||
|> map(fn: (r) => ({ _value: if r._value_key2 == 0 then 1.0 else float(v: r._value_key1) / float(v: r._value_key2), environment_id: r.environment_id, runner_id: r.runner_id, stage: r.stage }))
|
10
deploy/grafana-dashboard/queries/file-download.flux
Normal file
10
deploy/grafana-dashboard/queries/file-download.flux
Normal file
@ -0,0 +1,10 @@
|
||||
import "strings"
|
||||
|
||||
myWindowPeriod = if int(v: v.windowPeriod) > int(v: 1m) then duration(v: int(v: v.windowPeriod) * 100) else duration(v: int(v: v.windowPeriod) * 5)
|
||||
result = from(bucket: "poseidon/autogen")
|
||||
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|
||||
|> filter(fn: (r) => r["_measurement"] == "poseidon_file_download")
|
||||
|> filter(fn: (r) => r["_field"] == "actual_length")
|
||||
|> filter(fn: (r) => contains(value: r["environment_id"], set: ${environment_ids:json}))
|
||||
|> filter(fn: (r) => (not exists r.stage) or contains(value: r["stage"], set: ${stages:json}))
|
||||
|> keep(columns: ["_time", "_value", "environment_id", "stage"])
|
@ -3,6 +3,7 @@ def read_query(*names):
|
||||
for name in names:
|
||||
with open("queries/" + name + ".flux", "r") as file:
|
||||
result += file.read()
|
||||
result += "\n"
|
||||
return result
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user