@@ -20,12 +20,12 @@ type client interface {
20
20
getVersion () (* version.Version , error )
21
21
getGlobalStats () (map [string ]string , error )
22
22
getInnodbStats () (map [string ]string , error )
23
- getTableStats () ([]TableStats , error )
24
- getTableIoWaitsStats () ([]TableIoWaitsStats , error )
25
- getIndexIoWaitsStats () ([]IndexIoWaitsStats , error )
26
- getStatementEventsStats () ([]StatementEventStats , error )
23
+ getTableStats () ([]tableStats , error )
24
+ getTableIoWaitsStats () ([]tableIoWaitsStats , error )
25
+ getIndexIoWaitsStats () ([]indexIoWaitsStats , error )
26
+ getStatementEventsStats () ([]statementEventStats , error )
27
27
getTableLockWaitEventStats () ([]tableLockWaitEventStats , error )
28
- getReplicaStatusStats () ([]ReplicaStatusStats , error )
28
+ getReplicaStatusStats () ([]replicaStatusStats , error )
29
29
Close () error
30
30
}
31
31
@@ -37,7 +37,7 @@ type mySQLClient struct {
37
37
statementEventsTimeLimit time.Duration
38
38
}
39
39
40
- type IoWaitsStats struct {
40
+ type ioWaitsStats struct {
41
41
schema string
42
42
name string
43
43
countDelete int64
@@ -50,16 +50,16 @@ type IoWaitsStats struct {
50
50
timeUpdate int64
51
51
}
52
52
53
- type TableIoWaitsStats struct {
54
- IoWaitsStats
53
+ type tableIoWaitsStats struct {
54
+ ioWaitsStats
55
55
}
56
56
57
- type IndexIoWaitsStats struct {
58
- IoWaitsStats
57
+ type indexIoWaitsStats struct {
58
+ ioWaitsStats
59
59
index string
60
60
}
61
61
62
- type TableStats struct {
62
+ type tableStats struct {
63
63
schema string
64
64
name string
65
65
rows int64
@@ -68,7 +68,7 @@ type TableStats struct {
68
68
indexLength int64
69
69
}
70
70
71
- type StatementEventStats struct {
71
+ type statementEventStats struct {
72
72
schema string
73
73
digest string
74
74
digestText string
@@ -110,7 +110,7 @@ type tableLockWaitEventStats struct {
110
110
sumTimerWriteExternal int64
111
111
}
112
112
113
- type ReplicaStatusStats struct {
113
+ type replicaStatusStats struct {
114
114
replicaIOState string
115
115
sourceHost string
116
116
sourceUser string
@@ -260,7 +260,7 @@ func (c *mySQLClient) getInnodbStats() (map[string]string, error) {
260
260
}
261
261
262
262
// getTableStats queries the db for information_schema table size metrics.
263
- func (c * mySQLClient ) getTableStats () ([]TableStats , error ) {
263
+ func (c * mySQLClient ) getTableStats () ([]tableStats , error ) {
264
264
query := "SELECT TABLE_SCHEMA, TABLE_NAME, " +
265
265
"COALESCE(TABLE_ROWS, 0) as TABLE_ROWS, " +
266
266
"COALESCE(AVG_ROW_LENGTH, 0) as AVG_ROW_LENGTH, " +
@@ -273,9 +273,9 @@ func (c *mySQLClient) getTableStats() ([]TableStats, error) {
273
273
return nil , err
274
274
}
275
275
defer rows .Close ()
276
- var stats []TableStats
276
+ var stats []tableStats
277
277
for rows .Next () {
278
- var s TableStats
278
+ var s tableStats
279
279
err := rows .Scan (& s .schema , & s .name ,
280
280
& s .rows , & s .averageRowLength ,
281
281
& s .dataLength , & s .indexLength )
@@ -289,7 +289,7 @@ func (c *mySQLClient) getTableStats() ([]TableStats, error) {
289
289
}
290
290
291
291
// getTableIoWaitsStats queries the db for table_io_waits metrics.
292
- func (c * mySQLClient ) getTableIoWaitsStats () ([]TableIoWaitsStats , error ) {
292
+ func (c * mySQLClient ) getTableIoWaitsStats () ([]tableIoWaitsStats , error ) {
293
293
query := "SELECT OBJECT_SCHEMA, OBJECT_NAME, " +
294
294
"COUNT_DELETE, COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE," +
295
295
"FLOOR(SUM_TIMER_DELETE/1000), FLOOR(SUM_TIMER_FETCH/1000), FLOOR(SUM_TIMER_INSERT/1000), FLOOR(SUM_TIMER_UPDATE/1000) " +
@@ -300,9 +300,9 @@ func (c *mySQLClient) getTableIoWaitsStats() ([]TableIoWaitsStats, error) {
300
300
return nil , err
301
301
}
302
302
defer rows .Close ()
303
- var stats []TableIoWaitsStats
303
+ var stats []tableIoWaitsStats
304
304
for rows .Next () {
305
- var s TableIoWaitsStats
305
+ var s tableIoWaitsStats
306
306
err := rows .Scan (& s .schema , & s .name ,
307
307
& s .countDelete , & s .countFetch , & s .countInsert , & s .countUpdate ,
308
308
& s .timeDelete , & s .timeFetch , & s .timeInsert , & s .timeUpdate )
@@ -316,7 +316,7 @@ func (c *mySQLClient) getTableIoWaitsStats() ([]TableIoWaitsStats, error) {
316
316
}
317
317
318
318
// getIndexIoWaitsStats queries the db for index_io_waits metrics.
319
- func (c * mySQLClient ) getIndexIoWaitsStats () ([]IndexIoWaitsStats , error ) {
319
+ func (c * mySQLClient ) getIndexIoWaitsStats () ([]indexIoWaitsStats , error ) {
320
320
query := "SELECT OBJECT_SCHEMA, OBJECT_NAME, ifnull(INDEX_NAME, 'NONE') as INDEX_NAME," +
321
321
"COUNT_FETCH, COUNT_INSERT, COUNT_UPDATE, COUNT_DELETE," +
322
322
"FLOOR(SUM_TIMER_FETCH/1000), FLOOR(SUM_TIMER_INSERT/1000), FLOOR(SUM_TIMER_UPDATE/1000), FLOOR(SUM_TIMER_DELETE/1000) " +
@@ -328,9 +328,9 @@ func (c *mySQLClient) getIndexIoWaitsStats() ([]IndexIoWaitsStats, error) {
328
328
return nil , err
329
329
}
330
330
defer rows .Close ()
331
- var stats []IndexIoWaitsStats
331
+ var stats []indexIoWaitsStats
332
332
for rows .Next () {
333
- var s IndexIoWaitsStats
333
+ var s indexIoWaitsStats
334
334
err := rows .Scan (& s .schema , & s .name , & s .index ,
335
335
& s .countDelete , & s .countFetch , & s .countInsert , & s .countUpdate ,
336
336
& s .timeDelete , & s .timeFetch , & s .timeInsert , & s .timeUpdate )
@@ -343,7 +343,7 @@ func (c *mySQLClient) getIndexIoWaitsStats() ([]IndexIoWaitsStats, error) {
343
343
return stats , nil
344
344
}
345
345
346
- func (c * mySQLClient ) getStatementEventsStats () ([]StatementEventStats , error ) {
346
+ func (c * mySQLClient ) getStatementEventsStats () ([]statementEventStats , error ) {
347
347
query := fmt .Sprintf ("SELECT ifnull(SCHEMA_NAME, 'NONE') as SCHEMA_NAME, DIGEST," +
348
348
"LEFT(DIGEST_TEXT, %d) as DIGEST_TEXT, FLOOR(SUM_TIMER_WAIT/1000), SUM_ERRORS," +
349
349
"SUM_WARNINGS, SUM_ROWS_AFFECTED, SUM_ROWS_SENT, SUM_ROWS_EXAMINED," +
@@ -364,9 +364,9 @@ func (c *mySQLClient) getStatementEventsStats() ([]StatementEventStats, error) {
364
364
}
365
365
defer rows .Close ()
366
366
367
- var stats []StatementEventStats
367
+ var stats []statementEventStats
368
368
for rows .Next () {
369
- var s StatementEventStats
369
+ var s statementEventStats
370
370
err := rows .Scan (& s .schema , & s .digest , & s .digestText ,
371
371
& s .sumTimerWait , & s .countErrors , & s .countWarnings ,
372
372
& s .countRowsAffected , & s .countRowsSent , & s .countRowsExamined , & s .countCreatedTmpDiskTables ,
@@ -414,7 +414,7 @@ func (c *mySQLClient) getTableLockWaitEventStats() ([]tableLockWaitEventStats, e
414
414
return stats , nil
415
415
}
416
416
417
- func (c * mySQLClient ) getReplicaStatusStats () ([]ReplicaStatusStats , error ) {
417
+ func (c * mySQLClient ) getReplicaStatusStats () ([]replicaStatusStats , error ) {
418
418
mysqlVersion , err := c .getVersion ()
419
419
if err != nil {
420
420
return nil , err
@@ -439,9 +439,9 @@ func (c *mySQLClient) getReplicaStatusStats() ([]ReplicaStatusStats, error) {
439
439
return nil , err
440
440
}
441
441
442
- var stats []ReplicaStatusStats
442
+ var stats []replicaStatusStats
443
443
for rows .Next () {
444
- var s ReplicaStatusStats
444
+ var s replicaStatusStats
445
445
dest := []any {}
446
446
for _ , col := range cols {
447
447
switch strings .ToLower (col ) {
0 commit comments