Skip to content

Commit

Permalink
Merge #1436
Browse files Browse the repository at this point in the history
1436: Add pie chart to grafana r=popzxc a=ly0va



Co-authored-by: Lyova Potyomkin <[email protected]>
  • Loading branch information
bors-matterlabs-dev[bot] and ly0va authored Mar 10, 2021
2 parents 11a2655 + ce6d552 commit 908be71
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
56 changes: 49 additions & 7 deletions infrastructure/grafana/dashboards/statistics.jsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local G = import '../generator.libsonnet';

local stat(title, metric) =
local stat(title, metric, x=0, y=0) =
G.grafana.statPanel.new(
title,
datasource = 'Prometheus',
Expand All @@ -10,16 +10,58 @@ local stat(title, metric) =
metric,
legendFormat = '{{namespace}}'
)
) + { gridPos: { h: G.height, w: G.width } };
) + { gridPos: { h: G.height, w: 12, 'x': x, 'y': y } };

local pie(title, metrics) =
local addSlice(chart, metric) =
local formatted = std.strReplace(metric, '.', '_');
chart.addTarget(
G.grafana.prometheus.target(
'avg(rate(%s_sum[1d]))' % [formatted],
legendFormat = metric,
)
);
local chart = G.grafana.pieChartPanel.new(title);
std.foldl(addSlice, metrics, chart);

local metrics = [
"eth_sender.load_new_operations",
"sql.chain.stats.count_total_transactions",
"sql.chain.block.get_block_executed_ops",
"sql.chain.block.get_block",
"api.rpc.account_info",
"sql.chain.account.account_state_by_id",
"sql.chain.account.last_committed_state_for_account",
"sql.chain.operations_ext.get_account_transactions_history",
"sql.chain.account.account_state_by_address",
"api.rpc.get_account_state",
"sql.connection_acquire",
"sql.ethereum.load_unprocessed_operations",
"ticker.get_tx_fee",
"api.rpc.get_tx_fee",
"ticker.get_last_quote",
"api.rpc.get_token_price",
"ticker.coingecko_request",
"sql.chain.account.get_account_and_last_block",
"eth_sender.proceed_next_operations",
"eth_client.direct.tx_receipt",
"eth_client.direct.get_tx_status",
"eth_client.direct.current_nonce",
"eth_client.direct.current_nonce",
"witness_generator.prepare_witness_and_save_it",
"ticker.get_token_price",
"sql.chain.operations.get_last_block_by_aggregated_action",
];

G.dashboardRaw(
'statistics',
[
stat('COMMIT not confirmed operations', 'count_operations{action="COMMIT", confirmed="false"}'),
stat('VERIFY not confirmed operations', 'count_operations{action="VERIFY", confirmed="false"}'),
stat('COMMIT confirmed operations', 'count_operations{action="COMMIT", confirmed="true"}'),
stat('VERIFY confirmed operations', 'count_operations{action="VERIFY", confirmed="true"}'),
stat('Transaction batch sizes', 'tx_batch_size'),
pie('Time', metrics) + { gridPos: { h: G.height, w: 12, x: 0, y: 0 } },
stat('Transaction batch sizes', 'tx_batch_size', 12, 0),
stat('COMMIT not confirmed operations', 'count_operations{action="COMMIT", confirmed="false"}', 0, 10),
stat('VERIFY not confirmed operations', 'count_operations{action="VERIFY", confirmed="false"}', 12, 10),
stat('COMMIT confirmed operations', 'count_operations{action="COMMIT", confirmed="true"}', 0, 20),
stat('VERIFY confirmed operations', 'count_operations{action="VERIFY", confirmed="true"}', 12, 20),
]
)

3 changes: 2 additions & 1 deletion infrastructure/grafana/generator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
samples(metric, span = '1h')::
local formatted = std.strReplace(metric, '.', '_');
$.grafana.graphPanel.new(
title = metric + '[count]',
title = metric + ' [COUNT]',
datasource = 'Prometheus',
format = 'RPS',
).addTarget(
$.grafana.prometheus.target(
'rate(%s_count[%s])' % [formatted, span],
Expand Down

0 comments on commit 908be71

Please sign in to comment.