-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sinkv2(ticdc): add mq worker flush duration metric (#7263)
ref #5928
- Loading branch information
1 parent
a2d605f
commit 4d31b61
Showing
12 changed files
with
267 additions
and
95 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
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
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
File renamed without changes.
File renamed without changes.
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,36 @@ | ||
// Copyright 2022 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 mq | ||
|
||
import ( | ||
"github.com/pingcap/tiflow/cdc/sinkv2/metrics/mq/kafka" | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
// WorkerFlushDuration records the duration of flushing a group messages. | ||
var WorkerFlushDuration = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "mq_worker_flush_duration", | ||
Help: "Flush duration(s) for MQ worker. " + | ||
"It contains the grouping, encoding, and asynchronous sending off a batch of data.", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20), // 1ms~1000s | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
// InitMetrics registers all metrics in this file. | ||
func InitMetrics(registry *prometheus.Registry) { | ||
registry.MustRegister(WorkerFlushDuration) | ||
kafka.InitMetrics(registry) | ||
} |
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,82 @@ | ||
// Copyright 2022 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 txn | ||
|
||
import "github.com/prometheus/client_golang/prometheus" | ||
|
||
// ---------- Metrics for txn sink and backends. ---------- // | ||
var ( | ||
// ConflictDetectDuration records the duration of detecting conflict. | ||
ConflictDetectDuration = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_conflict_detect_duration", | ||
Help: "Bucketed histogram of conflict detect time (s) for single DML statement.", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20), // 1ms~1000s | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
WorkerFlushDuration = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_worker_flush_duration", | ||
Help: "Flush duration (s) for txn worker.", | ||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20), // 1ms~1000s | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
WorkerBusyRatio = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_worker_busy_ratio", | ||
Help: "Busy ratio (X ms in 1s) for all workers.", | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
WorkerHandledRows = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_worker_handled_rows", | ||
Help: "Busy ratio (X ms in 1s) for all workers.", | ||
}, []string{"namespace", "changefeed", "id"}) | ||
|
||
SinkDMLBatchCommit = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_sink_dml_batch_commit", | ||
Help: "Duration of committing a DML batch", | ||
Buckets: prometheus.ExponentialBuckets(0.01, 2, 18), // 10ms~1000s | ||
}, []string{"namespace", "changefeed"}) | ||
|
||
SinkDMLBatchCallback = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "ticdc", | ||
Subsystem: "sinkv2", | ||
Name: "txn_sink_dml_batch_callback", | ||
Help: "Duration of execuing a batch of callbacks", | ||
Buckets: prometheus.ExponentialBuckets(0.01, 2, 18), // 10ms~1000s | ||
}, []string{"namespace", "changefeed"}) | ||
) | ||
|
||
// InitMetrics registers all metrics in this file. | ||
func InitMetrics(registry *prometheus.Registry) { | ||
registry.MustRegister(ConflictDetectDuration) | ||
registry.MustRegister(WorkerFlushDuration) | ||
registry.MustRegister(WorkerBusyRatio) | ||
registry.MustRegister(WorkerHandledRows) | ||
registry.MustRegister(SinkDMLBatchCommit) | ||
registry.MustRegister(SinkDMLBatchCallback) | ||
} |
Oops, something went wrong.