postgres_exporter/postgres_mixin/dashboards/dashboards.libsonnet
Joe Adams 5d10f23241 Rework postgres_mixin dashboard
Rework the postgres_mixing dashboard to be more composable. The goal is for this to be more maintainable long term. I don't know jsonnet very well, but following other projects, this appears to be in line.

This replaces the postgres-overview.json dashboard with an overview.json dashboard with the same panels. While the dashboard does not match perfectly, it does include the same data but with the correct metrics.

Signed-off-by: Joe Adams <github@joeadams.io>
2023-09-12 22:20:50 -04:00

42 lines
1.5 KiB
Plaintext

local g = import 'g.libsonnet';
local dashboard = g.dashboard;
local row = g.panel.row;
local panels = import './panels.libsonnet';
local variables = import './variables.libsonnet';
local queries = import './queries.libsonnet';
// import config
local c = import '../config.libsonnet';
{
grafanaDashboards+:: {
'overview.json':
dashboard.new('%s Overview' % $._config.dashboardNamePrefix)
+ dashboard.withTags($._config.dashboardTags)
+ dashboard.withRefresh('1m')
+ dashboard.time.withFrom(value='now-1h')
+ dashboard.graphTooltip.withSharedCrosshair()
+ dashboard.withVariables([
variables.datasource,
])
+ dashboard.withPanels(
g.util.grid.makeGrid([
row.new('Overview')
+ row.withPanels([
panels.stat.qps('QPS', queries.qps),
panels.timeSeries.ratio1('Cache Hit Ratio', queries.cacheHitRatio),
panels.timeSeries.base('Active Connections', queries.activeConnections)
]),
row.new('server')
+ row.withPanels([
panels.timeSeries.base('Conflicts/Deadlocks', [queries.conflicts, queries.deadlocks]),
panels.timeSeries.base('Buffers', [queries.buffersAlloc, queries.buffersBackendFsync, queries.buffersBackend, queries.buffersClean, queries.buffersCheckpoint]),
panels.timeSeries.base('Rows', [queries.databaseTupFetched, queries.databaseTupReturned, queries.databaseTupInserted, queries.databaseTupUpdated, queries.databaseTupDeleted]),
]),
])
)
}
}