Skip to content

Commit

Permalink
dashboard: use Grafana 11 color scheme in overview table
Browse files Browse the repository at this point in the history
Before this patch, older Grafana 6 color scheme were used for overview
panel. It was fine for Grafana from 8 to 10, but don't work properly
with Grafana 11. After this patch, the panel works properly with
Grafana 11 and newer. For Grafana 9 and 10 everything works fine, except
for row coloring: only single cell is colored [1]. For Grafana 8 and
older, table column hiding no longer works properly so it's simpler
for us to treat it as unsupported since it's EOLed 1 year and 3 months
ago [2].

1. grafana/grafana#27542
2. https://endoflife.date/grafana

Follows #234
  • Loading branch information
DifferentialOrange committed Oct 4, 2024
1 parent f9a04bc commit c044e9b
Show file tree
Hide file tree
Showing 17 changed files with 957 additions and 331 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Use Grafana 11 color scheme for Prometheus cluster overview panel (#234)
- Drop Grafana 8 support (#234)
- Bump recommended requirements to Grafana 11 (#234)

### Fixed
- Prometheus cluster overview panel not works for Grafana 11+ (#234)

Expand Down
2 changes: 1 addition & 1 deletion dashboard/build/dashboard.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function(cfg) std.foldl(
type='grafana',
id='grafana',
name='Grafana',
version='8.0.0'
version='9.0.0'
).addRequired(
type='panel',
id='graph',
Expand Down
213 changes: 162 additions & 51 deletions dashboard/panels/cluster.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,17 @@ local prometheus = grafana.prometheus;
Instance alias filtering is disabled here.
If Prometheus job filter is not specified, displays running instances
and ignores unreachable instances (we have no specific source to fetch)
and ignores unreachable instances (we have no specific source to fetch).
Color scheme is expected to work properly only for Grafana 11+.
|||),
):: tablePanel.new(
title=title,
description=description,
datasource=cfg.datasource,

styles=[
{
alias: 'Instance alias',
pattern: 'alias',
thresholds: [],
type: 'string',
mappingType: 1,
},
{
alias: 'Instance URI',
pattern: 'instance',
thresholds: [],
type: 'string',
mappingType: 1,
},
{
alias: 'Uptime',
colorMode: 'row',
colors: [
'rgba(245, 54, 54, 0.9)',
'rgba(237, 129, 40, 0.89)',
'rgba(50, 172, 45, 0.97)',
],
decimals: 0,
mappingType: 1,
pattern: 'Value',
thresholds: ['0.1', '0.1'],
type: 'number',
unit: 's',
},
{
alias: 'job',
pattern: 'job',
thresholds: [],
type: 'hidden',
},
{
alias: 'Time',
pattern: 'Time',
thresholds: [],
type: 'hidden',
},
{
alias: '__name__',
pattern: '__name__',
thresholds: [],
type: 'hidden',
},
],
styles=null,

sort={
col: 2,
desc: false,
Expand Down Expand Up @@ -114,7 +69,163 @@ local prometheus = grafana.prometheus;
)
else if cfg.type == variable.datasource_type.influxdb then
error 'InfluxDB target is not supported yet'
) { gridPos: { w: 12, h: 8 } },
) {
// Workaround is expected to be removed after migrating to
// https://github.com/tarantool/grafana-dashboard/issues/215
fieldConfig: {
defaults: {
custom: {
cellOptions: {
type: 'auto',
},
inspect: false,
},
mappings: [],
thresholds: {
mode: 'absolute',
steps: [
{
color: 'green',
value: null,
},
{
color: 'red',
value: 80,
},
],
},
},
overrides: [
{
matcher: {
id: 'byName',
options: 'alias',
},
properties: [
{
id: 'displayName',
value: 'Instance alias',
},
{
id: 'custom.align',
},
],
},
{
matcher: {
id: 'byName',
options: 'instance',
},
properties: [
{
id: 'displayName',
value: 'Instance URI',
},
{
id: 'custom.align',
},
],
},
{
matcher: {
id: 'byName',
options: 'Value',
},
properties: [
{
id: 'displayName',
value: 'Uptime',
},
{
id: 'unit',
value: 's',
},
{
id: 'custom.cellOptions',
value: {
applyToRow: true,
type: 'color-background',
},
},
{
id: 'custom.align',
},
{
id: 'thresholds',
value: {
mode: 'absolute',
steps: [
{
color: 'rgba(245, 54, 54, 0.9)',
value: null,
},
{
color: 'rgba(50, 172, 45, 0.97)',
value: 0.1,
},
],
},
},
],
},
{
matcher: {
id: 'byName',
options: 'job',
},
properties: [
{
id: 'displayName',
value: 'job',
},
{
id: 'custom.hidden',
value: true,
},
{
id: 'custom.align',
},
],
},
{
matcher: {
id: 'byName',
options: 'job',
},
properties: [
{
id: 'custom.hidden',
value: true,
},
],
},
{
matcher: {
id: 'byName',
options: 'Time',
},
properties: [
{
id: 'custom.hidden',
value: true,
},
],
},
{
matcher: {
id: 'byName',
options: '__name__',
},
properties: [
{
id: 'custom.hidden',
value: true,
},
],
},
],
},
} { gridPos: { w: 12, h: 8 } },

local title_workaround( // Workaround for missing options.fieldOptions.defaults.title https://github.com/grafana/grafonnet-lib/pull/260
stat_panel,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.cartridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:
- ./example_cluster/prometheus/alerts.yml:/etc/prometheus/cartridge_alerts.yml

grafana:
image: grafana/grafana:8.1.3
image: grafana/grafana:11.2.2
environment:
GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true"
GF_AUTH_ANONYMOUS_ENABLED: "true"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.localapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- ./example_cluster/prometheus/alerts.yml:/etc/prometheus/alerts.yml

grafana:
image: grafana/grafana:8.1.5
image: grafana/grafana:11.2.2
environment:
GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true"
GF_AUTH_ANONYMOUS_ENABLED: "true"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.tdg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ services:
- ./example_cluster/prometheus/prometheus.tdg.yml:/etc/prometheus/prometheus.yml

grafana:
image: grafana/grafana:8.1.5
image: grafana/grafana:11.2.2
environment:
GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true"
GF_AUTH_ANONYMOUS_ENABLED: "true"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:
- ./example_cluster/prometheus/alerts.yml:/etc/prometheus/alerts.yml

grafana:
image: grafana/grafana:8.1.3
image: grafana/grafana:11.2.2
environment:
GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION: "true"
GF_AUTH_ANONYMOUS_ENABLED: "true"
Expand Down
2 changes: 1 addition & 1 deletion tests/InfluxDB/dashboard_cartridge_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "grafana",
"name": "Grafana",
"type": "grafana",
"version": "8.0.0"
"version": "9.0.0"
},
{
"id": "graph",
Expand Down
2 changes: 1 addition & 1 deletion tests/InfluxDB/dashboard_custom_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "grafana",
"name": "Grafana",
"type": "grafana",
"version": "8.0.0"
"version": "9.0.0"
},
{
"id": "graph",
Expand Down
2 changes: 1 addition & 1 deletion tests/InfluxDB/dashboard_tarantool3_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "grafana",
"name": "Grafana",
"type": "grafana",
"version": "8.0.0"
"version": "9.0.0"
},
{
"id": "graph",
Expand Down
2 changes: 1 addition & 1 deletion tests/InfluxDB/dashboard_tdg_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "grafana",
"name": "Grafana",
"type": "grafana",
"version": "8.0.0"
"version": "9.0.0"
},
{
"id": "graph",
Expand Down
2 changes: 1 addition & 1 deletion tests/InfluxDB/dashboard_with_custom_panels_compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "grafana",
"name": "Grafana",
"type": "grafana",
"version": "8.0.0"
"version": "9.0.0"
},
{
"id": "graph",
Expand Down
Loading

0 comments on commit c044e9b

Please sign in to comment.