forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metrics: add metrics for top sql (pingcap#25805)
- Loading branch information
1 parent
420e27e
commit fee39d3
Showing
4 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package metrics | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
// Top SQL metrics. | ||
var ( | ||
TopSQLIgnoredCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "tidb", | ||
Subsystem: "topsql", | ||
Name: "ignored_total", | ||
Help: "Counter of ignored top-sql metrics (register-sql, register-plan, collect-data and report-data), normally it should be 0.", | ||
}, []string{LblType}) | ||
|
||
TopSQLReportDurationHistogram = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "tidb", | ||
Subsystem: "topsql", | ||
Name: "report_duration_seconds", | ||
Help: "Bucket histogram of reporting time (s) to the top-sql agent", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 24), // 1ms ~ 2.3h | ||
}, []string{LblType, LblResult}) | ||
|
||
TopSQLReportDataHistogram = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "tidb", | ||
Subsystem: "topsql", | ||
Name: "report_data_total", | ||
Help: "Bucket histogram of reporting records/sql/plan count to the top-sql agent.", | ||
Buckets: prometheus.ExponentialBuckets(1, 2, 20), // 1 ~ 524288 | ||
}, []string{LblType}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters