Skip to content

Commit

Permalink
Added count-star datapoint
Browse files Browse the repository at this point in the history
  • Loading branch information
naman47vyas committed May 13, 2024
1 parent 5c4260a commit 317239c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions receiver/mysqlreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type StatementEventStats struct {
countSortMergePasses int64
countSortRows int64
countNoIndexUsed int64
countStar int64
}

type tableLockWaitEventStats struct {
Expand Down Expand Up @@ -275,7 +276,7 @@ func (c *mySQLClient) getStatementEventsStats() ([]StatementEventStats, error) {
"LEFT(DIGEST_TEXT, %d) as DIGEST_TEXT, SUM_TIMER_WAIT, SUM_ERRORS,"+
"SUM_WARNINGS, SUM_ROWS_AFFECTED, SUM_ROWS_SENT, SUM_ROWS_EXAMINED,"+
"SUM_CREATED_TMP_DISK_TABLES, SUM_CREATED_TMP_TABLES, SUM_SORT_MERGE_PASSES,"+
"SUM_SORT_ROWS, SUM_NO_INDEX_USED "+
"SUM_SORT_ROWS, SUM_NO_INDEX_USED , COUNT_STAR "+
"FROM performance_schema.events_statements_summary_by_digest "+
"WHERE SCHEMA_NAME NOT IN ('mysql', 'performance_schema', 'information_schema') "+
"AND last_seen > DATE_SUB(NOW(), INTERVAL %d SECOND) "+
Expand All @@ -298,7 +299,7 @@ func (c *mySQLClient) getStatementEventsStats() ([]StatementEventStats, error) {
err := rows.Scan(&s.schema, &s.digest, &s.digestText,
&s.sumTimerWait, &s.countErrors, &s.countWarnings,
&s.countRowsAffected, &s.countRowsSent, &s.countRowsExamined, &s.countCreatedTmpDiskTables,
&s.countCreatedTmpTables, &s.countSortMergePasses, &s.countSortRows, &s.countNoIndexUsed)
&s.countCreatedTmpTables, &s.countSortMergePasses, &s.countSortRows, &s.countNoIndexUsed, &s.countStar)
if err != nil {
return nil, err
}
Expand Down
6 changes: 6 additions & 0 deletions receiver/mysqlreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ require (
go.uber.org/zap v1.25.0
)

require (
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Expand All @@ -36,6 +41,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k0kubun/pp v3.0.1+incompatible
github.com/klauspost/compress v1.16.7 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/knadh/koanf/v2 v2.0.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions receiver/mysqlreceiver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 317239c

Please sign in to comment.