Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new owner: port metrics from the old owner (#1886) #1892

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cdc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package cdc
import (
"github.com/pingcap/ticdc/cdc/entry"
"github.com/pingcap/ticdc/cdc/kv"
"github.com/pingcap/ticdc/cdc/owner"
"github.com/pingcap/ticdc/cdc/processor"
tablepipeline "github.com/pingcap/ticdc/cdc/processor/pipeline"
"github.com/pingcap/ticdc/cdc/puller"
Expand All @@ -39,9 +40,10 @@ func init() {
if config.NewReplicaImpl {
processor.InitMetrics(registry)
tablepipeline.InitMetrics(registry)
owner.InitMetrics(registry)
} else {
initProcessorMetrics(registry)
initOwnerMetrics(registry)
}
initOwnerMetrics(registry)
initServerMetrics(registry)
}
55 changes: 55 additions & 0 deletions cdc/owner/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2020 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 owner

import "github.com/prometheus/client_golang/prometheus"

var (
changefeedCheckpointTsGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "ticdc",
Subsystem: "owner",
Name: "checkpoint_ts",
Help: "checkpoint ts of changefeeds",
}, []string{"changefeed"})
changefeedCheckpointTsLagGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "ticdc",
Subsystem: "owner",
Name: "checkpoint_ts_lag",
Help: "checkpoint ts lag of changefeeds",
}, []string{"changefeed"})
ownershipCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "ticdc",
Subsystem: "owner",
Name: "ownership_counter",
Help: "The counter of ownership increases every 5 seconds on a owner capture",
})
ownerMaintainTableNumGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "ticdc",
Subsystem: "owner",
Name: "maintain_table_num",
Help: "number of replicated tables maintained in owner",
}, []string{"changefeed", "capture", "type"})
)

// InitMetrics registers all metrics used in owner
func InitMetrics(registry *prometheus.Registry) {
registry.MustRegister(changefeedCheckpointTsGauge)
registry.MustRegister(changefeedCheckpointTsLagGauge)
registry.MustRegister(ownershipCounter)
registry.MustRegister(ownerMaintainTableNumGauge)
}