-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/TencentBlueKing/bk-bcs in…
…to example-1014
- Loading branch information
Showing
90 changed files
with
9,861 additions
and
899 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making Blueking Container Service available. | ||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. | ||
* Licensed under the MIT License (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* http://opensource.org/licenses/MIT | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package service | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
|
||
"github.com/TencentBlueKing/bk-bcs/bcs-services/bcs-bscp/pkg/metrics" | ||
) | ||
|
||
var ( | ||
metricInstance *metric | ||
once sync.Once | ||
) | ||
|
||
func initMetric() *metric { | ||
once.Do(func() { | ||
m := new(metric) | ||
labels := prometheus.Labels{} | ||
m.syncQueueLen = prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: metrics.Namespace, | ||
Subsystem: metrics.RepoSyncSubSys, | ||
Name: "sync_queue_len", | ||
Help: "the length of sync queue for repo sync", | ||
ConstLabels: labels, | ||
}) | ||
metrics.Register().MustRegister(m.syncQueueLen) | ||
|
||
m.ackQueueLen = prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: metrics.Namespace, | ||
Subsystem: metrics.RepoSyncSubSys, | ||
Name: "ack_queue_len", | ||
Help: "the length of ack queue for repo sync", | ||
ConstLabels: labels, | ||
}) | ||
metrics.Register().MustRegister(m.ackQueueLen) | ||
|
||
metricInstance = m | ||
|
||
}) | ||
return metricInstance | ||
} | ||
|
||
type metric struct { | ||
// syncQueueLen records the length of sync queue for repo sync | ||
syncQueueLen prometheus.Gauge | ||
|
||
// ackQueueLen records the length of ack queue for repo sync | ||
ackQueueLen prometheus.Gauge | ||
} |
Oops, something went wrong.