-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
status.go
96 lines (89 loc) · 3.18 KB
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
Copyright 2019 The Vitess Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreedto in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"vitess.io/vitess/go/vt/servenv"
_ "vitess.io/vitess/go/vt/status"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/vttablet/tabletmanager/vreplication"
"vitess.io/vitess/go/vt/vttablet/tabletserver"
)
var (
// tabletTemplate contains the style sheet and the tablet itself.
// This template is a slight duplicate of the one in go/vt/vttablet/tabletserver/status.go.
tabletTemplate = `
<style>
table {
border-collapse: collapse;
}
td, th {
border: 1px solid #999;
padding: 0.5rem;
}
.time {
width: 15%;
}
.healthy {
background-color: LightGreen;
}
.unhealthy {
background-color: Salmon;
}
.unhappy {
background-color: Khaki;
}
</style>
<table width="100%" border="" frame="">
<tr border="">
<td width="25%" border="">
Alias: {{github_com_vitessio_vitess_vtctld_tablet .Tablet.AliasString}}<br>
Keyspace: {{github_com_vitessio_vitess_vtctld_keyspace .Tablet.Keyspace}} Shard: {{github_com_vitessio_vitess_vtctld_shard .Tablet.Keyspace .Tablet.Shard}} Tablet Type: {{.Tablet.Type}}<br>
SrvKeyspace: {{github_com_vitessio_vitess_vtctld_srv_keyspace .Tablet.Alias.Cell .Tablet.Keyspace}}<br>
Replication graph: {{github_com_vitessio_vitess_vtctld_replication .Tablet.Alias.Cell .Tablet.Keyspace .Tablet.Shard}}<br>
{{if .DeniedTables}}
DeniedTables: {{range .DeniedTables}}{{.}} {{end}}<br>
{{end}}
</td>
<td width="25%" border="">
<a href="/schemaz">Schema</a></br>
<a href="/debug/tablet_plans">Schema Query Plans</a></br>
<a href="/debug/query_stats">Schema Query Stats</a></br>
<a href="/queryz">Query Stats</a></br>
</td>
<td width="25%" border="">
<a href="/debug/consolidations">Consolidations</a></br>
<a href="/querylogz">Current Query Log</a></br>
<a href="/txlogz">Current Transaction Log</a></br>
<a href="/twopcz">In-flight 2PC Transactions</a></br>
</td>
<td width="25%" border="">
<a href="/healthz">Health Check</a></br>
<a href="/debug/health">Query Service Health Check</a></br>
<a href="/livequeryz/">Real-time Queries</a></br>
<a href="/debug/status_details">JSON Status Details</a></br>
<a href="/debug/env">View/Change Environment variables</a></br>
</td>
</tr>
</table>
`
)
func addStatusParts(qsc tabletserver.Controller) {
servenv.AddStatusPart("Tablet", tabletTemplate, func() any {
return map[string]any{
"Tablet": topo.NewTabletInfo(tm.Tablet(), nil),
"DeniedTables": tm.DeniedTables(),
}
})
qsc.AddStatusPart()
vreplication.AddStatusPart()
}