Skip to content

Commit

Permalink
infoschema/metric_schema: add tikv metric tables (pingcap#14498)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 authored Feb 4, 2020
1 parent 7ba002e commit 2192448
Show file tree
Hide file tree
Showing 6 changed files with 1,868 additions and 790 deletions.
4 changes: 2 additions & 2 deletions executor/cluster_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ func (s *testClusterReaderSuite) TestMetricTableData(c *C) {

tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use metric_schema")
rs, err := tk.Se.Execute(ctx, "select * from query_duration;")
rs, err := tk.Se.Execute(ctx, "select * from tidb_query_duration;")
c.Assert(err, IsNil)
result := tk.ResultSetToResultWithCtx(ctx, rs[0], Commentf("execute sql fail"))
result.Check(testkit.Rows(
"2019-12-23 20:11:35.000000 0.1 127.0.0.1:10080 0.9"))

rs, err = tk.Se.Execute(ctx, "select * from query_duration where quantile in (0.85, 0.95);")
rs, err = tk.Se.Execute(ctx, "select * from tidb_query_duration where quantile in (0.85, 0.95);")
c.Assert(err, IsNil)
result = tk.ResultSetToResultWithCtx(ctx, rs[0], Commentf("execute sql fail"))
result.Check(testkit.Rows(
Expand Down
2 changes: 1 addition & 1 deletion executor/explainfor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *testSuite) TestIssue11124(c *C) {

func (s *testSuite) TestExplainMetricTable(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustQuery(fmt.Sprintf("desc select * from METRIC_SCHEMA.query_duration where time >= '2019-12-23 16:10:13' and time <= '2019-12-23 16:30:13' ")).Check(testkit.Rows(
tk.MustQuery(fmt.Sprintf("desc select * from METRIC_SCHEMA.tidb_query_duration where time >= '2019-12-23 16:10:13' and time <= '2019-12-23 16:30:13' ")).Check(testkit.Rows(
"MemTableScan_5 10000.00 root PromQL:histogram_quantile(0.9, sum(rate(tidb_server_handle_query_duration_seconds_bucket{}[60s])) by (le,sql_type,instance)), start_time:2019-12-23 16:10:13, end_time:2019-12-23 16:30:13, step:1m0s"))
tk.MustQuery(fmt.Sprintf("desc select * from METRIC_SCHEMA.up where time >= '2019-12-23 16:10:13' and time <= '2019-12-23 16:30:13' ")).Check(testkit.Rows(
"MemTableScan_5 10000.00 root PromQL:up{}, start_time:2019-12-23 16:10:13, end_time:2019-12-23 16:30:13, step:1m0s"))
Expand Down
Loading

0 comments on commit 2192448

Please sign in to comment.