Skip to content

Commit

Permalink
metrics: Clean up metrics (pingcap#5858)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli authored Feb 11, 2018
1 parent 8af98f5 commit e5ffc40
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions metrics/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ var (
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20),
})

SyncerInit = "syncer_init"
SyncerRestart = "syncer_restart"
SyncerClear = "syncer_clear"
SyncerInit = "init"
SyncerRestart = "restart"
SyncerClear = "clear"

DeploySyncerHistogram = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Expand Down Expand Up @@ -78,14 +78,14 @@ var (
}, []string{"op", "result_state"})

// Metrics for ddl_worker.go.
WorkerAddDDLJob = "add_ddl_job"
WorkerFinishDDLJob = "finish_ddl_job"
WorkerAddDDLJob = "add_job"
WorkerFinishDDLJob = "finish_job"
WorkerWaitSchemaChanged = "wait_schema_changed"
DDLWorkerHistogram = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "tidb",
Subsystem: "ddl",
Name: "ddl_worker_operation",
Name: "worker_operation_duration_seconds",
Help: "Bucketed histogram of processing time (s) of ddl worker operations",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20),
}, []string{"op", "result_state"})
Expand All @@ -97,7 +97,7 @@ var (
prometheus.CounterOpts{
Namespace: "tidb",
Subsystem: "ddl",
Name: "ddl_counter",
Name: "worker_total",
Help: "Counter of creating ddl/worker and isowner.",
}, []string{"type"})
)
Expand Down
10 changes: 5 additions & 5 deletions metrics/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
// Metrics
var (
GlobalAutoID = "global"
TableAutoIDAlloc = "table"
TableAutoIDRebase = "table_rebase"
TableAutoIDAlloc = "alloc"
TableAutoIDRebase = "rebase"
AutoIDHistogram = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "tidb",
Subsystem: "meta",
Name: "autoid_alloc",
Subsystem: "autoid",
Name: "operation_duration_seconds",
Help: "Bucketed histogram of processing time (s) of handled autoid.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 22),
}, []string{"op", "result_state"})
Expand All @@ -41,7 +41,7 @@ var (
prometheus.HistogramOpts{
Namespace: "tidb",
Subsystem: "meta",
Name: "meta_opt",
Name: "operation_duration_seconds",
Help: "Bucketed histogram of processing time (s) of tidb meta data operations.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 22),
}, []string{"op", "result_state"})
Expand Down
6 changes: 3 additions & 3 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const (
LabelDDL = "ddl"
LabelGCWorker = "gcworker"

opSucc = "op_succ"
opFailed = "op_failed"
opSucc = "ok"
opFailed = "err"
)

// RetLabel returns "op_succ" when err == nil and "op_failed" when err != nil.
// RetLabel returns "ok" when err == nil and "err" when err != nil.
// This could be useful when you need to observe the operation result.
func RetLabel(err error) string {
if err == nil {
Expand Down
12 changes: 6 additions & 6 deletions metrics/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ var (
Help: "Counter of critical errors.",
})

EventStart = "server_start"
EventGracefulDown = "server_graceful_shutdown"
EventStart = "start"
EventGracefulDown = "graceful_shutdown"
// Eventkill occurs when the server.Kill() function is called.
EventKill = "server_kill"
EventKill = "kill"
// EventHang occurs when server meet some critical error. It will close the listening port and hang for ever.
EventHang = "server_hang"
EventClose = "server_close"
EventHang = "hang"
EventClose = "close"
ServerEventCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "tidb",
Subsystem: "server",
Name: "server_event",
Name: "event_total",
Help: "Counter of tidb-server event.",
}, []string{"type"})
)
Expand Down

0 comments on commit e5ffc40

Please sign in to comment.