Skip to content

Commit ae6b14e

Browse files
authored
Release v2022.05.16.1 (#1257)
* fix: missing fields in slowquery * fix dev build exit unexpectedly (#1207) * fix wrong time unit for slow query (#1212) * invalidate assets cache (#1208) * enable query when conprof is disabled (#1217) * feat: improve statement (#1234) * misc: bump ech (#1238) * feat: use ech for overview charts (#1241) * feat: show more metrics in overview (#1242) * feat: show info about data delay for Top SQL (#1244) * feat: multi-line logs by default (#1245) * feat: enlarge log display area (#1248) * feat: select all profiling types and instances by default (#1249) * fix: prevent enter overview page before auth (#1251) * ui: polish the layout of profiling (#1253) * feat: do not autoload data when network slow in slow query (#1254) * ui: small polish (#1260)
1 parent 5ac6966 commit ae6b14e

File tree

187 files changed

+7055
-3600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+7055
-3600
lines changed

Diff for: .github/workflows/manual-create-pd-pr.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ jobs:
1212
name: Create PD PR
1313
runs-on: ubuntu-latest
1414
strategy:
15+
fail-fast: false
1516
matrix:
16-
branch: [master, release-5.3, release-5.4]
17+
branch: [master, release-5.4, release-6.1]
1718
steps:
1819
- name: Check out PD code base
1920
uses: actions/checkout@master
@@ -27,6 +28,9 @@ jobs:
2728
run: |
2829
go get -d "github.com/pingcap/tidb-dashboard@${{ github.event.inputs.release_version }}"
2930
go mod tidy
31+
cd tests/client
32+
go mod tidy
33+
cd ../..
3034
make pd-server
3135
go mod tidy
3236
- name: Commit PD code base change
@@ -55,6 +59,8 @@ jobs:
5559
body: |
5660
### What problem does this PR solve?
5761
62+
Issue Number: ref #4257
63+
5864
Update TiDB Dashboard to ${{ github.event.inputs.release_version }}.
5965
6066
Upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .

Diff for: .github/workflows/release.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ jobs:
8888
runs-on: ubuntu-latest
8989
needs: release
9090
strategy:
91+
fail-fast: false
9192
matrix:
92-
branch: [master, release-6.0]
93+
branch: [master, release-5.4, release-6.1]
9394
steps:
9495
- name: Check out PD code base
9596
uses: actions/checkout@master
@@ -103,6 +104,9 @@ jobs:
103104
run: |
104105
go get -d "github.com/pingcap/tidb-dashboard@${{ needs.release.outputs.release_version }}"
105106
go mod tidy
107+
cd tests/client
108+
go mod tidy
109+
cd ../..
106110
make pd-server
107111
go mod tidy
108112
- name: Commit PD code base change
@@ -131,6 +135,8 @@ jobs:
131135
body: |
132136
### What problem does this PR solve?
133137
138+
Issue Number: ref #4257
139+
134140
This is an automatic updating PR for TiDB Dashboard. See #4257 for details.
135141
136142
This PR updates TiDB Dashboard to ${{ needs.release.outputs.release_version }} for upstream commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }} .

Diff for: .github/workflows/test.yaml

+14-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,24 @@ jobs:
7070
e2e_test:
7171
name: E2E Test
7272
runs-on: ubuntu-latest
73-
timeout-minutes: 20
73+
timeout-minutes: 30
7474
strategy:
75+
fail-fast: false
7576
matrix:
7677
# test latest features and compatibility of lower version
7778
include:
7879
- feature_version: 6.0.0
7980
tidb_version: nightly
81+
without_ngm: false
82+
- feature_version: 6.0.0
83+
tidb_version: nightly
84+
without_ngm: true
85+
- feature_version: 5.4.0
86+
tidb_version: v5.4.0
87+
without_ngm: false
8088
- feature_version: 5.0.0
8189
tidb_version: v5.0.0
90+
without_ngm: false
8291
steps:
8392
- name: Checkout code
8493
uses: actions/checkout@v2
@@ -114,7 +123,7 @@ jobs:
114123
- name: Install and run TiUP in the background
115124
run: |
116125
chmod u+x scripts/start_tiup.sh
117-
scripts/start_tiup.sh ${{ matrix.tidb_version }}
126+
scripts/start_tiup.sh ${{ matrix.tidb_version }} ${{ matrix.without_ngm }}
118127
- name: Build UI
119128
run: |
120129
make ui
@@ -147,18 +156,14 @@ jobs:
147156
UI: 1
148157
FEATURE_VERSION: ${{ matrix.feature_version }}
149158
- name: Run E2E Features Test
150-
run: make test_e2e
159+
run: make e2e_test
151160
env:
152161
SERVER_URL: http://127.0.0.1:12333/dashboard/
153162
CI: true
154163
FEATURE_VERSION: ${{ matrix.feature_version }}
155164
TIDB_VERSION: ${{ matrix.tidb_version }}
156-
- name: Archive Test Results
157-
if: always()
158-
run: |
159-
cat ui/start_tiup.log
160-
echo "==============="
161-
cat ui/wait_tiup.log
165+
CYPRESS_ALLOW_SCREENSHOT: true
166+
WITHOUT_NGM: ${{ matrix.without_ngm }}
162167
- name: Upload coverage to Codecov
163168
uses: codecov/codecov-action@v2
164169
with:

Diff for: .github/workflows/upload-e2e-snapshots.yaml

+18-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,24 @@ on:
77
ref:
88
description: "The branch, tag or SHA to create snapshots"
99
required: true
10+
spec:
11+
description: "Specify the spec files to run, example: `topsql/topsql.spec.ts`"
12+
required: true
1013

1114
jobs:
1215
e2e_test_snapshots:
1316
name: Take E2E Test Snapshots
1417
runs-on: ubuntu-latest
15-
timeout-minutes: 20
18+
timeout-minutes: 30
1619
strategy:
20+
fail-fast: false
1721
matrix:
1822
# test latest features and compatibility of lower version
1923
include:
2024
- feature_version: 6.0.0
2125
tidb_version: nightly
26+
- feature_version: 5.4.0
27+
tidb_version: v5.4.0
2228
- feature_version: 5.0.0
2329
tidb_version: v5.0.0
2430
steps:
@@ -58,7 +64,7 @@ jobs:
5864
- name: Install and run TiUP in the background
5965
run: |
6066
chmod u+x scripts/start_tiup.sh
61-
scripts/start_tiup.sh ${{ matrix.tidb_version }}
67+
scripts/start_tiup.sh ${{ matrix.tidb_version }} false
6268
- name: Build UI
6369
run: |
6470
make ui
@@ -89,22 +95,26 @@ jobs:
8995
env:
9096
UI: 1
9197
FEATURE_VERSION: ${{ matrix.feature_version }}
98+
- name: Delete Previous Snapshots
99+
run: rm -rf ${{ github.workspace }}/ui/cypress/snapshots
92100
- name: Run E2E Features Test
93-
run: make e2e_test
101+
run: make e2e_test_specify
94102
env:
95103
SERVER_URL: http://127.0.0.1:12333/dashboard/
96104
CI: true
97105
FEATURE_VERSION: ${{ matrix.feature_version }}
98106
TIDB_VERSION: ${{ matrix.tidb_version }}
99107
CYPRESS_ALLOW_SCREENSHOT: true
100-
- name: Archive Test Results
108+
E2E_SPEC: cypress/integration/${{ github.event.inputs.spec }}
109+
- name: Archive Test Video
101110
if: always()
102-
run: |
103-
cat ui/start_tiup.log
104-
echo "==============="
105-
cat ui/wait_tiup.log
111+
uses: actions/upload-artifact@v2
112+
with:
113+
name: e2e-video-${{ matrix.feature_version }}
114+
path: ${{ github.workspace }}/ui/cypress/videos/**/*
106115
- name: Upload snapshots artifact
107116
uses: actions/upload-artifact@v2
117+
if: always()
108118
with:
109119
name: e2e-snapshots-${{ matrix.feature_version }}
110120
path: ${{ github.workspace }}/ui/cypress/snapshots/**/*

Diff for: CONTRIBUTING.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
Thanks for your interest in contributing to TiDB Dashboard! This document outlines some of the conventions on building, running, and testing TiDB Dashboard, the development workflow, commit message formatting, contact points and other resources.
44

5-
If you need any help (for example, mentoring getting started or understanding the codebase), feel free to join the discussion of [Diagnosis SIG] (Special Interest Group):
6-
7-
- Slack: [#sig-diagnosis](https://slack.tidb.io/invite?team=tidb-community&channel=sig-diagnosis&ref=github_dashboard_repo)
5+
If you need any help (for example, mentoring getting started or understanding the codebase), feel free to reach out on the [TiDB Internals forum](https://internals.tidb.io/).
86

97
## Setting up a development workspace
108

Diff for: Makefile

+37-10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ LDFLAGS ?=
66

77
FEATURE_VERSION ?= 6.0.0
88

9+
WITHOUT_NGM ?= false
10+
11+
E2E_SPEC ?=
12+
913
ifeq ($(UI),1)
1014
BUILD_TAGS += ui_server
1115
endif
@@ -45,6 +49,39 @@ integration_test:
4549
@mkdir -p ./coverage
4650
@TIDB_VERSION=${TIDB_VERSION} tests/run.sh
4751

52+
.PHONY: e2e_test
53+
e2e_test:
54+
@if $(WITHOUT_NGM); then\
55+
make e2e_without_ngm_test;\
56+
else\
57+
make e2e_compat_features_test;\
58+
make e2e_common_features_test;\
59+
fi
60+
61+
.PHONY: e2e_compat_features_test
62+
e2e_compat_features_test:
63+
cd ui &&\
64+
yarn &&\
65+
yarn run:e2e-test:compat-features --env FEATURE_VERSION=$(FEATURE_VERSION) TIDB_VERSION=$(TIDB_VERSION)
66+
67+
.PHONY: e2e_common_features_test
68+
e2e_common_features_test:
69+
cd ui &&\
70+
yarn &&\
71+
yarn run:e2e-test:common-features --env TIDB_VERSION=$(TIDB_VERSION)
72+
73+
.PHONY: e2e_without_ngm_test
74+
e2e_without_ngm_test:
75+
cd ui &&\
76+
yarn &&\
77+
yarn run:e2e-test:without-ngm --env TIDB_VERSION=$(TIDB_VERSION) WITHOUT_NGM=$(WITHOUT_NGM)
78+
79+
.PHONY: e2e_test_specify
80+
e2e_test_specify:
81+
cd ui &&\
82+
yarn &&\
83+
yarn run:e2e-test:specify --env TIDB_VERSION=$(TIDB_VERSION) -- --spec $(E2E_SPEC)
84+
4885
.PHONY: dev
4986
dev: lint default
5087

@@ -74,13 +111,3 @@ endif
74111
.PHONY: run
75112
run:
76113
bin/tidb-dashboard --debug --experimental --feature-version "$(FEATURE_VERSION)" --host 0.0.0.0
77-
78-
test_e2e_compat_features:
79-
cd ui &&\
80-
yarn run:e2e-test:compat-features --env FEATURE_VERSION=$(FEATURE_VERSION) TIDB_VERSION=$(TIDB_VERSION)
81-
82-
test_e2e_common_features:
83-
cd ui &&\
84-
yarn run:e2e-test:common-features TIDB_VERSION=$(TIDB_VERSION)
85-
86-
test_e2e: test_e2e_compat_features test_e2e_common_features

Diff for: README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ TiDB Dashboard is a Web UI for monitoring, diagnosing and managing the TiDB clus
1616
Feel free to [open GitHub issues](https://github.com/pingcap/tidb-dashboard/issues/new/choose)
1717
for questions, support and suggestions.
1818

19-
You may also consider join our community chat in the Slack channel [#sig-diagnosis].
19+
You may also consider to reach out on the [TiDB Internals forum](https://internals.tidb.io/) if you encounter any problems about TiDB development.
2020

2121
For Chinese users, you can visit the PingCAP official user forum [AskTUG.com] to make life easier.
2222

@@ -37,7 +37,7 @@ for a list of recommended tasks, in which we have also marked the difficulty lev
3737
See [CONTRIBUTING.md](./CONTRIBUTING.md) for a detailed step-by-step contributing guide, or steps to
3838
build TiDB Dashboard from source.
3939

40-
If you need any help, feel free to community chat in the Slack channel [#sig-diagnosis].
40+
If you need any help, feel free to reach out on the [TiDB Internals forum](https://internals.tidb.io/).
4141

4242
Thank you to all the people who already contributed to TiDB Dashboard!
4343

@@ -86,5 +86,4 @@ TiDB Dashboard can also be integrated into PD, as follows:
8686
Copyright 2020 PingCAP, Inc.
8787

8888
[pd]: https://github.com/pingcap/pd
89-
[#sig-diagnosis]: https://slack.tidb.io/invite?team=tidb-community&channel=sig-diagnosis&ref=github_dashboard_repo
9089
[asktug.com]: https://asktug.com/

Diff for: pkg/apiserver/statement/models.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ import (
1212
"github.com/pingcap/tidb-dashboard/util/reflectutil"
1313
)
1414

15-
// TimeRange represents a range of time.
16-
type TimeRange struct {
17-
BeginTime int64 `json:"begin_time"`
18-
EndTime int64 `json:"end_time"`
19-
}
20-
2115
type Model struct {
16+
AggBeginTime int `json:"summary_begin_time" agg:"FLOOR(UNIX_TIMESTAMP(MIN(summary_begin_time)))"`
17+
AggEndTime int `json:"summary_end_time" agg:"FLOOR(UNIX_TIMESTAMP(MAX(summary_end_time)))"`
2218
AggDigestText string `json:"digest_text" agg:"ANY_VALUE(digest_text)"`
2319
AggDigest string `json:"digest" agg:"ANY_VALUE(digest)"`
2420
AggExecCount int `json:"exec_count" agg:"SUM(exec_count)"`

Diff for: pkg/apiserver/statement/queries.go

+4-16
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ const (
1414
statementsTable = "INFORMATION_SCHEMA.CLUSTER_STATEMENTS_SUMMARY_HISTORY"
1515
)
1616

17-
func queryTimeRanges(db *gorm.DB) (result []*TimeRange, err error) {
18-
err = db.
19-
Select(`
20-
DISTINCT
21-
FLOOR(UNIX_TIMESTAMP(summary_begin_time)) AS begin_time,
22-
FLOOR(UNIX_TIMESTAMP(summary_end_time)) AS end_time
23-
`).
24-
Table(statementsTable).
25-
Order("begin_time DESC, end_time DESC").
26-
Find(&result).Error
27-
return
28-
}
29-
3017
func queryStmtTypes(db *gorm.DB) (result []string, err error) {
3118
// why should put DISTINCT inside the `Pluck()` method, see here:
3219
// https://github.com/jinzhu/gorm/issues/496
@@ -64,7 +51,8 @@ func (s *Service) queryStatements(
6451
query := db.
6552
Select(selectStmt).
6653
Table(statementsTable).
67-
Where("summary_begin_time >= FROM_UNIXTIME(?) AND summary_end_time <= FROM_UNIXTIME(?)", beginTime, endTime).
54+
// https://stackoverflow.com/questions/3269434/whats-the-most-efficient-way-to-test-if-two-ranges-overlap
55+
Where("summary_begin_time <= FROM_UNIXTIME(?) AND summary_end_time >= FROM_UNIXTIME(?)", endTime, beginTime).
6856
Group("schema_name, digest").
6957
Order("agg_sum_latency DESC")
7058

@@ -130,7 +118,7 @@ func (s *Service) queryPlans(
130118
query := db.
131119
Select(selectStmt).
132120
Table(statementsTable).
133-
Where("summary_begin_time >= FROM_UNIXTIME(?) AND summary_end_time <= FROM_UNIXTIME(?)", beginTime, endTime).
121+
Where("summary_begin_time <= FROM_UNIXTIME(?) AND summary_end_time >= FROM_UNIXTIME(?)", endTime, beginTime).
134122
Group("plan_digest")
135123

136124
if digest == "" {
@@ -167,7 +155,7 @@ func (s *Service) queryPlanDetail(
167155
query := db.
168156
Select(selectStmt).
169157
Table(statementsTable).
170-
Where("summary_begin_time >= FROM_UNIXTIME(?) AND summary_end_time <= FROM_UNIXTIME(?)", beginTime, endTime)
158+
Where("summary_begin_time <= FROM_UNIXTIME(?) AND summary_end_time >= FROM_UNIXTIME(?)", endTime, beginTime)
171159

172160
if digest == "" {
173161
// the evicted record's digest will be NULL

Diff for: pkg/apiserver/statement/service.go

-16
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func registerRouter(r *gin.RouterGroup, auth *user.AuthService, s *Service) {
4848
{
4949
endpoint.GET("/config", s.configHandler)
5050
endpoint.POST("/config", auth.MWRequireWritePriv(), s.modifyConfigHandler)
51-
endpoint.GET("/time_ranges", s.timeRangesHandler)
5251
endpoint.GET("/stmt_types", s.stmtTypesHandler)
5352
endpoint.GET("/list", s.listHandler)
5453
endpoint.GET("/plans", s.plansHandler)
@@ -114,21 +113,6 @@ func (s *Service) modifyConfigHandler(c *gin.Context) {
114113
c.Status(http.StatusNoContent)
115114
}
116115

117-
// @Summary Get available statement time ranges
118-
// @Success 200 {array} statement.TimeRange
119-
// @Router /statements/time_ranges [get]
120-
// @Security JwtAuth
121-
// @Failure 401 {object} rest.ErrorResponse
122-
func (s *Service) timeRangesHandler(c *gin.Context) {
123-
db := utils.GetTiDBConnection(c)
124-
timeRanges, err := queryTimeRanges(db)
125-
if err != nil {
126-
rest.Error(c, err)
127-
return
128-
}
129-
c.JSON(http.StatusOK, timeRanges)
130-
}
131-
132116
// @Summary Get all statement types
133117
// @Success 200 {array} string
134118
// @Router /statements/stmt_types [get]

Diff for: pkg/apiserver/statement/statement_gen.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ func (s *Service) genSelectStmt(tableColumns []string, reqJSONColumns []string)
1919

2020
// use required fields filter when not all fields are requested
2121
if reqJSONColumns[0] != "*" {
22-
// "schema_name", "digest" for group, "sum_latency" for order
23-
requiredFields := funk.UniqString(append(reqJSONColumns, "schema_name", "digest", "sum_latency"))
22+
requiredFields := funk.UniqString(append(reqJSONColumns,
23+
"schema_name", "digest", // required by group by
24+
"sum_latency", // required by order
25+
"summary_begin_time", "summary_end_time",
26+
))
2427
fields = funk.Filter(fields, func(f Field) bool {
2528
return funk.Contains(requiredFields, f.JSONName)
2629
}).([]Field)

0 commit comments

Comments
 (0)