Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
fcaa726e
Unverified
Commit
fcaa726e
authored
Feb 18, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 18, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74080 from dims/ensure-prometheus-metrics-are-not-registered-twice
Ensure prometheus metrics are not registered twice
parents
98918243
8fa332cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
aws_metrics.go
pkg/cloudprovider/providers/aws/aws_metrics.go
+12
-4
openstack_metrics.go
pkg/cloudprovider/providers/openstack/openstack_metrics.go
+11
-3
No files found.
pkg/cloudprovider/providers/aws/aws_metrics.go
View file @
fcaa726e
...
@@ -16,7 +16,11 @@ limitations under the License.
...
@@ -16,7 +16,11 @@ limitations under the License.
package
aws
package
aws
import
"github.com/prometheus/client_golang/prometheus"
import
(
"sync"
"github.com/prometheus/client_golang/prometheus"
)
var
(
var
(
awsAPIMetric
=
prometheus
.
NewHistogramVec
(
awsAPIMetric
=
prometheus
.
NewHistogramVec
(
...
@@ -53,8 +57,12 @@ func recordAWSThrottlesMetric(operation string) {
...
@@ -53,8 +57,12 @@ func recordAWSThrottlesMetric(operation string) {
awsAPIThrottlesMetric
.
With
(
prometheus
.
Labels
{
"operation_name"
:
operation
})
.
Inc
()
awsAPIThrottlesMetric
.
With
(
prometheus
.
Labels
{
"operation_name"
:
operation
})
.
Inc
()
}
}
var
registerOnce
sync
.
Once
func
registerMetrics
()
{
func
registerMetrics
()
{
prometheus
.
MustRegister
(
awsAPIMetric
)
registerOnce
.
Do
(
func
()
{
prometheus
.
MustRegister
(
awsAPIErrorMetric
)
prometheus
.
MustRegister
(
awsAPIMetric
)
prometheus
.
MustRegister
(
awsAPIThrottlesMetric
)
prometheus
.
MustRegister
(
awsAPIErrorMetric
)
prometheus
.
MustRegister
(
awsAPIThrottlesMetric
)
})
}
}
pkg/cloudprovider/providers/openstack/openstack_metrics.go
View file @
fcaa726e
...
@@ -16,7 +16,11 @@ limitations under the License.
...
@@ -16,7 +16,11 @@ limitations under the License.
package
openstack
package
openstack
import
"github.com/prometheus/client_golang/prometheus"
import
(
"sync"
"github.com/prometheus/client_golang/prometheus"
)
const
(
const
(
openstackSubsystem
=
"openstack"
openstackSubsystem
=
"openstack"
...
@@ -44,7 +48,11 @@ var (
...
@@ -44,7 +48,11 @@ var (
)
)
)
)
var
registerOnce
sync
.
Once
func
registerMetrics
()
{
func
registerMetrics
()
{
prometheus
.
MustRegister
(
openstackOperationsLatency
)
registerOnce
.
Do
(
func
()
{
prometheus
.
MustRegister
(
openstackAPIRequestErrors
)
prometheus
.
MustRegister
(
openstackOperationsLatency
)
prometheus
.
MustRegister
(
openstackAPIRequestErrors
)
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment