delete no use code

This commit is contained in:
Ulric Qin 2022-04-27 15:55:35 +08:00
parent 5b4110675b
commit 2c85250113
7 changed files with 18 additions and 13 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/toolkits/pkg/container/list"
)
func (m *MySQL) gatherBinlog(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64) {
func (m *MySQL) gatherBinlog(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string) {
var logBin uint8
err := db.QueryRow(`SELECT @@log_bin`).Scan(&logBin)
if err != nil {

View File

@ -238,11 +238,11 @@ func (m *MySQL) gatherOnce(slist *list.SafeList, ins *Instance) {
m.gatherGlobalVariables(slist, ins, db, tags, cache)
m.gatherEngineInnodbStatus(slist, ins, db, tags, cache)
m.gatherEngineInnodbStatusCompute(slist, ins, db, tags, cache)
m.gatherBinlog(slist, ins, db, tags, cache)
m.gatherProcesslistByState(slist, ins, db, tags, cache)
m.gatherProcesslistByUser(slist, ins, db, tags, cache)
m.gatherSchemaSize(slist, ins, db, tags, cache)
m.gatherTableSize(slist, ins, db, tags, cache, false)
m.gatherTableSize(slist, ins, db, tags, cache, true)
m.gatherSlaveStatus(slist, ins, db, tags, cache)
m.gatherBinlog(slist, ins, db, tags)
m.gatherProcesslistByState(slist, ins, db, tags)
m.gatherProcesslistByUser(slist, ins, db, tags)
m.gatherSchemaSize(slist, ins, db, tags)
m.gatherTableSize(slist, ins, db, tags, false)
m.gatherTableSize(slist, ins, db, tags, true)
m.gatherSlaveStatus(slist, ins, db, tags)
}

View File

@ -90,7 +90,7 @@ var (
}
)
func (m *MySQL) gatherProcesslistByState(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64) {
func (m *MySQL) gatherProcesslistByState(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string) {
if !ins.GatherProcessListProcessByState {
return
}

View File

@ -9,7 +9,7 @@ import (
"github.com/toolkits/pkg/container/list"
)
func (m *MySQL) gatherProcesslistByUser(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64) {
func (m *MySQL) gatherProcesslistByUser(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string) {
if !ins.GatherProcessListProcessByUser {
return
}

View File

@ -9,7 +9,7 @@ import (
"github.com/toolkits/pkg/container/list"
)
func (m *MySQL) gatherSchemaSize(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64) {
func (m *MySQL) gatherSchemaSize(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string) {
if !ins.GatherSchemaSize {
return
}

View File

@ -14,7 +14,7 @@ import (
var slaveStatusQueries = [2]string{"SHOW ALL SLAVES STATUS", "SHOW SLAVE STATUS"}
var slaveStatusQuerySuffixes = [3]string{" NONBLOCKING", " NOLOCK", ""}
func (m *MySQL) gatherSlaveStatus(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64) {
func (m *MySQL) gatherSlaveStatus(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string) {
if !ins.GatherSlaveStatus {
return
}
@ -89,6 +89,11 @@ func (m *MySQL) gatherSlaveStatus(slist *list.SafeList, ins *Instance, db *sql.D
textItems["channel_name"] = textItems["connection_name"]
}
// default channel name is empty
if textItems["channel_name"] == "" {
textItems["channel_name"] = "default"
}
for k, v := range fields {
slist.PushFront(inputs.NewSample("slave_status_"+k, v, tags, map[string]string{
"master_host": textItems["master_host"],

View File

@ -9,7 +9,7 @@ import (
"github.com/toolkits/pkg/container/list"
)
func (m *MySQL) gatherTableSize(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, cache map[string]float64, isSystem bool) {
func (m *MySQL) gatherTableSize(slist *list.SafeList, ins *Instance, db *sql.DB, globalTags map[string]string, isSystem bool) {
query := SQL_QUERY_TABLE_SIZE
if isSystem {
query = SQL_QUERY_SYSTEM_TABLE_SIZE