-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80724: roachtest: add cluster stats utility r=kvoli a=kvoli This patch introduces cluster_stats, a utility wrapper for prometheus collected metrics. The motivation for this patch is to enable additional classes of roachtests to generate run statistics, on relevant cluster metrics. These run statistics are exported into a roachperf parseable stats.json. The utilities provided are: (1) collect and export metrics, per-node and in aggregate over a run; parseable by roachperf. (2) register and stream metrics for test processing at a fixed interval. (1) enables a arbitrary roachtests to declare and export relevant roachperf outputs. Where there is otherwise a binary outcome, we may now track performance over time. (2) reduces friction for testing assertions on cluster metrics, e.g. qps balance. This also makes dynamic workload testing easier, where workload application changes based on predicates of cluster statistics, e.g. switch key access distribution when qps becomes balanced. The allocator related roachtests do not currently export benchmark related statistics. This patch introduces stat collection on replicate/up/1to3, replicate/rebalance/3to5, rebalance/by-load/leases and rebalance/by-load/ranges. The benchmark metric for the nightly run is the time taken to reach balance, from starting the test. In addition, cluster statistics are exported for detailed view into: cpu usage, io bandwidth, qps and range counts. related: https://github.com/cockroachdb/roachperf/pull/94 Release note: None 83375: sql: allow foreign key to reference crdb_region column in REGIONAL BY ROW r=rytaft a=rytaft This commit loosens the restrictions on foreign key references to allow referencing `crdb_region` and other implicit partitioning columns used by `PARTITION ALL BY` tables. There is no technical reason why such references should be disallowed, so this commit simply removes the restriction. Fixes #74244 Release note (sql change): Foreign keys can now reference the `crdb_region` column in `REGIONAL BY ROW` tables even if `crdb_region` is not explicitly part of a `UNIQUE` constraint. This is possible since `crdb_region` is implicitly included in every index on `REGIONAL BY ROW` tables as the partitioning key. (This applies to whichever column is used as the partitioning column, in case a different name is used via `REGIONAL BY ROW AS`.) Co-authored-by: Austen McClernon <[email protected]> Co-authored-by: Rebecca Taft <[email protected]>
- Loading branch information
Showing
24 changed files
with
2,006 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
load("@bazel_gomock//:gomock.bzl", "gomock") | ||
|
||
go_library( | ||
name = "clusterstats", | ||
srcs = [ | ||
"collector.go", | ||
"doc.go", | ||
"exporter.go", | ||
"helpers.go", | ||
"streamer.go", | ||
], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/roachtest/clusterstats", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/cmd/roachtest/cluster", | ||
"//pkg/cmd/roachtest/test", | ||
"//pkg/roachprod/logger", | ||
"//pkg/roachprod/prometheus", | ||
"//pkg/util/search", | ||
"//pkg/util/timeutil", | ||
"@com_github_cockroachdb_errors//:errors", | ||
"@com_github_prometheus_client_golang//api", | ||
"@com_github_prometheus_client_golang//api/prometheus/v1:prometheus", | ||
"@com_github_prometheus_common//model", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "clusterstats_test", | ||
srcs = [ | ||
"exporter_test.go", | ||
"streamer_test.go", | ||
":clusterstats_mock", # keep | ||
], | ||
embed = [":clusterstats"], | ||
deps = [ | ||
"//pkg/roachprod/logger", | ||
"//pkg/roachprod/prometheus", | ||
"@com_github_golang_mock//gomock", | ||
"@com_github_prometheus_client_golang//api/prometheus/v1:prometheus", | ||
"@com_github_prometheus_common//model", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) | ||
|
||
gomock( | ||
name = "clusterstats_mock", | ||
out = "mocks_generated_test.go", | ||
interfaces = ["Client"], | ||
library = "//pkg/roachprod/prometheus", | ||
package = "clusterstats", | ||
visibility = [ | ||
":__pkg__", | ||
"//pkg/gen:__pkg__", | ||
], | ||
) |
Oops, something went wrong.