Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
c121e38d
Commit
c121e38d
authored
9 years ago
by
Maksadbek
Committed by
Cameron Sparr
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
mysql plugin, check for existence of table before scanning
parent
b16bc3d2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/inputs/mysql/mysql.go
+18
-0
18 additions, 0 deletions
plugins/inputs/mysql/mysql.go
with
18 additions
and
0 deletions
plugins/inputs/mysql/mysql.go
+
18
−
0
View file @
c121e38d
...
...
@@ -367,6 +367,12 @@ const (
FROM information_schema.schemata
WHERE SCHEMA_NAME NOT IN ('mysql', 'performance_schema', 'information_schema')
`
perfSchemaTablesQuery
=
`
SELECT
table_name
FROM information_schema.tables
WHERE table_schema = 'performance_schema' AND table_name = ?
`
)
func
(
m
*
Mysql
)
gatherServer
(
serv
string
,
acc
telegraf
.
Accumulator
)
error
{
...
...
@@ -847,6 +853,18 @@ func (m *Mysql) gatherInfoSchemaAutoIncStatuses(db *sql.DB, serv string, acc tel
// the total number and time for SQL and external lock wait events
// for each table and operation
func
(
m
*
Mysql
)
gatherPerfTableLockWaits
(
db
*
sql
.
DB
,
serv
string
,
acc
telegraf
.
Accumulator
)
error
{
// check if table exists,
// if performance_schema is not enabled, tables do not exist
// then there is no need to scan them
var
tableName
string
err
:=
db
.
QueryRow
(
perfSchemaTablesQuery
,
"table_lock_waits_summary_by_table"
)
.
Scan
(
&
tableName
)
switch
{
case
err
==
sql
.
ErrNoRows
:
return
nil
case
err
!=
nil
:
return
err
}
rows
,
err
:=
db
.
Query
(
perfTableLockWaitsQuery
)
if
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment