fix: add mariadb_dialect to address the MariaDB differences in INNODB_METRICS (#10486)
This commit is contained in:
parent
bcc7c57f18
commit
e8b08b10b7
|
|
@ -281,7 +281,8 @@ and process. It has following fields:
|
|||
for them. It has following fields:
|
||||
* auto_increment_column(int, number)
|
||||
* auto_increment_column_max(int, number)
|
||||
* InnoDB metrics - all metrics of information_schema.INNODB_METRICS with a status "enabled"
|
||||
* InnoDB metrics - all metrics of information_schema.INNODB_METRICS with a status "enabled". For MariaDB,
|
||||
`mariadb_dialect = true` to use `ENABLED=1`.
|
||||
* Perf table lock waits - gathers total number and time for SQL and external
|
||||
lock waits events for each table and operation. It has following fields.
|
||||
The unit of fields varies by the tags.
|
||||
|
|
|
|||
|
|
@ -231,6 +231,13 @@ const (
|
|||
FROM information_schema.INNODB_METRICS
|
||||
WHERE status='enabled'
|
||||
`
|
||||
innoDBMetricsQueryMariadb = `
|
||||
EXECUTE IMMEDIATE CONCAT("
|
||||
SELECT NAME, COUNT
|
||||
FROM information_schema.INNODB_METRICS
|
||||
WHERE ", IF(version() REGEXP '10\.[1-4].*',"status='enabled'", "ENABLED=1"), "
|
||||
");
|
||||
`
|
||||
perfTableIOWaitsQuery = `
|
||||
SELECT OBJECT_SCHEMA, OBJECT_NAME, COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE, COUNT_DELETE,
|
||||
SUM_TIMER_FETCH, SUM_TIMER_INSERT, SUM_TIMER_UPDATE, SUM_TIMER_DELETE
|
||||
|
|
@ -1245,8 +1252,18 @@ func (m *Mysql) gatherInfoSchemaAutoIncStatuses(db *sql.DB, serv string, acc tel
|
|||
// gatherInnoDBMetrics can be used to fetch enabled metrics from
|
||||
// information_schema.INNODB_METRICS
|
||||
func (m *Mysql) gatherInnoDBMetrics(db *sql.DB, serv string, acc telegraf.Accumulator) error {
|
||||
var (
|
||||
query string
|
||||
)
|
||||
|
||||
if m.MariadbDialect {
|
||||
query = innoDBMetricsQueryMariadb
|
||||
} else {
|
||||
query = innoDBMetricsQuery
|
||||
}
|
||||
|
||||
// run query
|
||||
rows, err := db.Query(innoDBMetricsQuery)
|
||||
rows, err := db.Query(query)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue