Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 80c6f54

Browse files
committed
Merge branch '207-dmius-sort-sign' into 'master'
Sort signs added somewhere, some reports improved Closes #207 See merge request postgres-ai-team/postgres-checkup!202
2 parents 5be07b1 + 47cdb8e commit 80c6f54

18 files changed

+35
-53
lines changed

pghrep/templates/A003.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Observations ##
44
{{ if .hosts.master }}
55
### Master (`{{.hosts.master}}`) ###
6-
▼ Setting | Value | Unit | Pretty value
6+
Setting | Value | Unit | Pretty value
77
--------|-------|------|--------------
88
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
99
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}

pghrep/templates/A004.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{{- end -}}
1414
{{ if (index (index (index .results .hosts.master) "data") "database_sizes") }}
1515
#### Databases sizes ####
16-
Database | Size
16+
Database | ▼ Size
1717
---------|------
1818
{{ range $i, $key := (index (index (index (index .results .hosts.master) "data") "database_sizes") "_keys") }}
1919
{{- $value := (index (index (index (index $.results $.hosts.master) "data") "database_sizes") $key) -}}

pghrep/templates/A006.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{ if (index .diffData "pg_settings") }}
77
Setting | {{.hosts.master}} {{ range $skey, $host := .hosts.replicas }}| {{ $host }} {{ end }}
88
--------|-------{{ range $skey, $host := .hosts.replicas }}|-------- {{ end }}
9-
{{ range $key, $value := (index .diffData "pg_settings") }}{{ $key }} {{ range $key, $value := $value }} |{{ index $value "value" }} {{ if (index $value "unit") }}({{ index $value "unit" }}){{ end }}{{ end }}
9+
{{ range $key, $value := (index .diffData "pg_settings") }}{{ $key }} {{ range $key, $value := $value }} | {{ if (index $value "unit") }}{{ UnitValue (index $value "value") (index $value "unit") }}{{else}}{{ index $value "value" }}{{ end }}{{ end }}
1010
{{ end }}
1111
{{ else }}
1212
No `pg_settings` differences
@@ -15,7 +15,7 @@ No `pg_settings` differences
1515
Configs(pg_config) that differ
1616
### Configs(pg_config) that differ ###
1717
{{ range $key, $value := (index .diffData "pg_configs") }}
18-
Config {{ $key }}: {{ range $key, $value := $value }} On {{ $key }}: `{{ index $value "value" }}` {{ if (index $value "unit") }}{{ index $value "unit" }}{{ end }}{{ end }}
18+
Config {{ $key }}: {{ range $key, $value := $value }} On {{ $key }}: {{ if (index $value "unit") }}{{ UnitValue (index $value "value") (index $value "unit") }}{{else}}{{ index $value "value" }}{{ end }}{{ end }}
1919
{{ end }}
2020
{{ else }}
2121
No `pg_configs` differences

pghrep/templates/F002.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Master (`{{.hosts.master}}`) ###
66
{{ if index (index (index .results .hosts.master) "data") "per_instance" }}
77
#### Per instance ####
8-
Database | Age | Capacity used, % | Warning | datfrozenxid
8+
Database | ▼ Age | Capacity used, % | Warning | datfrozenxid
99
----------|-----|------------------|---------|--------------
1010
{{ range $i, $key := (index (index (index (index .results .hosts.master) "data") "per_instance") "_keys") }}
1111
{{- $value := (index (index (index (index $.results $.hosts.master) "data") "per_instance") $key) -}}
@@ -19,7 +19,7 @@
1919

2020
{{/* if index (index (index .results .hosts.master) "data") "per_database" */}}
2121
#### Per database ####
22-
Relation | Age | Capacity used, % | Warning |rel_relfrozenxid | toast_relfrozenxid
22+
Relation | Age | ▼ Capacity used, % | Warning |rel_relfrozenxid | toast_relfrozenxid
2323
----------|-----|------------------|---------|-----------------|--------------------
2424
{{ range $i, $key := (index (index (index (index .results .hosts.master) "data") "per_database") "_keys") }}
2525
{{- $value := (index (index (index (index $.results $.hosts.master) "data") "per_database") $key) -}}

pghrep/templates/F004.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
{{ if .hosts.master }}
66
### Master (`{{.hosts.master}}`) ###
77
{{ if (index (index .results .hosts.master) "data") }}
8-
Table | ▼ Size | Extra | Bloat | Live | Last vacuum | Fillfactor
8+
Table | Size | Extra | ▼ Bloat estimate| Live | Last vacuum | Fillfactor
99
-------|------|-------|-------|------|-------------|-------------
1010
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
1111
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}
12-
{{ $key }} | {{ ( index $value "Size") }} | {{ ( index $value "Extra") }} | {{ ( index $value "Bloat") }} | {{ ( index $value "Live") }} | {{ if (index $value "Last Vaccuum") }} {{ ( index $value "Last Vaccuum") }} {{ end }} | {{ ( index $value "Fillfactor") }}
12+
{{ $key }} | {{ ( index $value "Size") }} | {{ ( index $value "Extra") }} | {{ ( index $value "Bloat estimate") }} | {{ ( index $value "Live") }} | {{ if (index $value "Last Vaccuum") }} {{ ( index $value "Last Vaccuum") }} {{ end }} | {{ ( index $value "Fillfactor") }}
1313
{{ end }}
1414
{{- else -}}
1515
No data

pghrep/templates/F005.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Observations ##
55
{{ if .hosts.master }}
66
### Master (`{{.hosts.master}}`) ###
7-
Index (Table) | Size | Extra | Bloat | Live | Fill factor
7+
Index (Table) | ▼ Size | Extra | Bloat | Live | Fill factor
88
---------------|------|-------|-------|------|-------------
99
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
1010
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}

pghrep/templates/F008.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ Ram amount you can see in report A001
2222

2323
{{- $autovacuum_work_mem := (RawIntUnitValue (index (index (index .results .hosts.master) "data") "autovacuum_work_mem").setting (index (index (index .results .hosts.master) "data") "autovacuum_work_mem").unit) -}}
2424
{{- $maintenance_work_mem := (RawIntUnitValue (index (index (index .results .hosts.master) "data") "maintenance_work_mem").setting (index (index (index .results .hosts.master) "data") "maintenance_work_mem").unit) -}}
25-
{{- $max_connections := (RawIntUnitValue (index (index (index .results .hosts.master) "data") "max_connections").setting (index (index (index .results .hosts.master) "data") "max_connections").unit) }}
25+
{{- $autovacuum_max_workers := (RawIntUnitValue (index (index (index .results .hosts.master) "data") "autovacuum_max_workers").setting (index (index (index .results .hosts.master) "data") "autovacuum_max_workers").unit) }}
2626

2727
{{ if eq $autovacuum_work_mem -1 -}}
28-
Max workers memory: {{ ByteFormat ( Mul $maintenance_work_mem $max_connections ) 0 }}
28+
Max workers memory: {{ ByteFormat ( Mul $maintenance_work_mem $autovacuum_max_workers ) 0 }}
2929
{{- else -}}
30-
Max workers memory: {{ ByteFormat ( Mul $autovacuum_work_mem $max_connections ) 0 }}
30+
Max workers memory: {{ ByteFormat ( Mul $autovacuum_work_mem $autovacuum_max_workers ) 0 }}
3131
{{- end }}
3232

3333

pghrep/templates/G002.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Observations ##
44
{{ if .hosts.master }}
55
### Master (`{{.hosts.master}}`) ###
6-
Num | User | DB | Current state | Count | State changed >1m ago | State changed >1h ago
6+
\# | User | DB | Current state | Count | State changed >1m ago | State changed >1h ago
77
----|------|----|---------------|-------|-----------------------|-----------------------
88
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
99
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}
@@ -17,7 +17,7 @@ Num | User | DB | Current state | Count | State changed >1m ago | State changed
1717
{{ range $skey, $host := .hosts.replicas }}
1818
#### Replica (`{{ $host }}`) ####
1919
{{ if (index $.results $host) }}
20-
Num | User | DB | Current state | Count | State changed >1m ago | State changed >1h ago
20+
\# | User | DB | Current state | Count | State changed >1m ago | State changed >1h ago
2121
----|------|----|---------------|-------|-----------------------|-----------------------
2222
{{ range $i, $key := (index (index (index $.results $host) "data") "_keys") }}
2323
{{- $value := (index (index (index $.results $host) "data") $key) -}}

pghrep/templates/G003.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ User | Setting
3737
{{- end -}}
3838
{{ if (index (index (index .results .hosts.master) "data") "databases_stat") }}
3939
#### Databases data ####
40-
Database | Conflicts | Deadlocks | Stats reset at | Stat reset
40+
Database | Conflicts | ▼ Deadlocks | Stats reset at | Stat reset
4141
-------------|-------|-----------|----------------|------------
4242
{{ range $i, $key := (index (index (index (index .results .hosts.master) "data") "databases_stat") "_keys") }}
4343
{{- $value:= (index (index (index (index $.results $.hosts.master) "data") "databases_stat") $key) -}}
@@ -85,7 +85,7 @@ User | Setting
8585
{{- end -}}
8686
{{ if (index (index (index $.results $host) "data") "databases_stat") }}
8787
#### Databases data ####
88-
Database | Conflicts | Deadlocks | Stats reset at | Stat reset
88+
Database | Conflicts | ▼ Deadlocks | Stats reset at | Stat reset
8989
-------------|-------|-----------|----------------|------------
9090
{{ range $i, $key := (index (index (index (index $.results $host) "data") "databases_stat") "_keys") }}
9191
{{- $value:= (index (index (index (index $.results $host) "data") "databases_stat") $key) -}}

pghrep/templates/H001.tpl

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
### Master (`{{.hosts.master}}`) ###
77

88
{{ if (index (index .results .hosts.master) "data") }}
9-
Num | Schema name | Table name | Index name | Index size
9+
\# | Schema name | Table name | Index name | Index size
1010
----|-------------|------------|------------|------------
1111
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
1212
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}
@@ -21,31 +21,6 @@ Invalid indexes not found
2121
{{- end -}}{{/* if data */}}
2222
{{- end -}}{{/* if .host.master */}}
2323

24-
{{ if .hosts.replicas }}
25-
### Replica servers: ###
26-
{{ range $skey, $host := .hosts.replicas }}
27-
#### Replica (`{{ $host }}`) ####
28-
{{ if (index $.results $host) }}
29-
{{- if (index (index $.results $host) "data") -}}
30-
Num | Schema name | Table name | Index name | Index size
31-
----|-------------|------------|------------|------------
32-
{{ range $i, $key := (index (index (index $.results $host) "data") "_keys") }}
33-
{{- $value := (index (index (index $.results $host) "data") $key) -}}
34-
{{ $key }} |
35-
{{- $value.schema_name }} |
36-
{{- $value.table_name }} |
37-
{{- $value.index_name }} |
38-
{{- $value.index_size }}
39-
{{ end }}{{/* range */}}
40-
{{ else }}
41-
Invalid indexes not found
42-
{{- end -}}{{/* if data */}}
43-
{{- else -}}{{/* if $.results $host */}}
44-
Invalid indexes not found
45-
{{- end -}}{{/* if $.results $host */}}
46-
{{- end -}}{{/* replicas range*/}}
47-
{{- end -}}{{/* if replica */}}
48-
4924
## Conclusions ##
5025

5126

0 commit comments

Comments
 (0)