-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metrics: add connection and fail metrics by resource group name
#49424
Changes from all commits
7b50915
132a8c2
f2d4233
8b811ef
c83ad92
d787dfd
43202cc
ee8fed8
048c1ea
74f6497
2d2ecaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2457,7 +2457,7 @@ func (cli *TestServerClient) getMetrics(t *testing.T) []byte { | |
|
||
func getStmtCnt(content string) (stmtCnt map[string]int) { | ||
stmtCnt = make(map[string]int) | ||
r := regexp.MustCompile("tidb_executor_statement_total{db=\"\",type=\"([A-Z|a-z|-]+)\"} (\\d+)") | ||
r := regexp.MustCompile("tidb_executor_statement_total{db=\"\",resource_group=\".*\",type=\"([A-Z|a-z|-]+)\"} (\\d+)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not requivalent, It's can't match if removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? it's add a new filter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If not add this filter , it returns 0, all the related test will fail,. |
||
matchResult := r.FindAllStringSubmatch(content, -1) | ||
for _, v := range matchResult { | ||
cnt, _ := strconv.Atoi(v[2]) | ||
|
@@ -2468,7 +2468,7 @@ func getStmtCnt(content string) (stmtCnt map[string]int) { | |
|
||
func getDBStmtCnt(content, dbName string) (stmtCnt map[string]int) { | ||
stmtCnt = make(map[string]int) | ||
r := regexp.MustCompile(fmt.Sprintf("tidb_executor_statement_total{db=\"%s\",type=\"([A-Z|a-z|-]+)\"} (\\d+)", dbName)) | ||
r := regexp.MustCompile(fmt.Sprintf("tidb_executor_statement_total{db=\"%s\",resource_group=\".*\",type=\"([A-Z|a-z|-]+)\"} (\\d+)", dbName)) | ||
matchResult := r.FindAllStringSubmatch(content, -1) | ||
for _, v := range matchResult { | ||
cnt, _ := strconv.Atoi(v[2]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly,
Savepoint
can be executed in any session, thus, pass resource-group label "" can result in incorrect result. But since prometheus metrics does not provide a iter api, seems there is no good way to handle thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it will panic if ignore the label.