Files
tidb/executor/metrics.go

40 lines
1.0 KiB
Go

// Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
package executor
import (
"github.com/pingcap/tidb/ast"
"github.com/prometheus/client_golang/prometheus"
)
var (
stmtNodeCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "tidb",
Subsystem: "executor",
Name: "statement_node_total",
Help: "Counter of StmtNode.",
}, []string{"type"})
)
func init() {
prometheus.MustRegister(stmtNodeCounter)
}
func stmtCount(node ast.StmtNode) {
if stmtLable := statementLabel(node); stmtLable != IGNORE {
stmtNodeCounter.WithLabelValues(stmtLable).Inc()
}
}