-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
11 changed files
with
367 additions
and
1,414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
/.metrics.*.removed | ||
/tools/src | ||
/vendor | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
_config+:: { | ||
postgresExporterSelector: '', | ||
|
||
dashboardNamePrefix: 'Postgres Exporter / ', | ||
dashboardTags: ['postgres-exporter-mixin'], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
local dashboards = (import 'mixin.libsonnet').grafanaDashboards; | ||
|
||
{ [name]: dashboards[name] for name in std.objectFields(dashboards)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,41 @@ | ||
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+:: { | ||
'postgres-overview.json': (import 'postgres-overview.json'), | ||
}, | ||
'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]), | ||
]), | ||
]) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
local g = import 'g.libsonnet'; | ||
|
||
{ | ||
stat: { | ||
local stat = g.panel.stat, | ||
|
||
base(title, targets): | ||
stat.new(title) | ||
+stat.queryOptions.withTargets(targets), | ||
|
||
qps: self.base, | ||
}, | ||
|
||
timeSeries: { | ||
local timeSeries = g.panel.timeSeries, | ||
|
||
base(title, targets): | ||
timeSeries.new(title) | ||
+timeSeries.queryOptions.withTargets(targets), | ||
|
||
ratio(title, targets): | ||
self.base(title, targets) | ||
+ timeSeries.standardOptions.withUnit('percentunit'), | ||
|
||
ratio1(title, targets): | ||
self.ratio(title, targets) | ||
+ timeSeries.standardOptions.withUnit('percentunit') | ||
+ timeSeries.standardOptions.withMax(1) | ||
} | ||
} |
Oops, something went wrong.