mirror of https://github.com/prometheus/prometheus
Browse Source
SD Managers take over responsibility for SD metrics registration --------- Signed-off-by: Paulin Todev <paulin.todev@gmail.com> Signed-off-by: Björn Rabenstein <github@rabenste.in> Co-authored-by: Björn Rabenstein <github@rabenste.in>pull/13447/head
Paulin Todev
10 months ago
committed by
GitHub
91 changed files with 2523 additions and 630 deletions
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 aws |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
type ec2Metrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
var _ discovery.DiscovererMetrics = (*ec2Metrics)(nil) |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *ec2Metrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *ec2Metrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 aws |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
type lightsailMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
var _ discovery.DiscovererMetrics = (*lightsailMetrics)(nil) |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *lightsailMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *lightsailMetrics) Unregister() {} |
@ -0,0 +1,64 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 azure |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*azureMetrics)(nil) |
||||
|
||||
type azureMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
|
||||
failuresCount prometheus.Counter |
||||
cacheHitCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &azureMetrics{ |
||||
refreshMetrics: rmi, |
||||
failuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_azure_failures_total", |
||||
Help: "Number of Azure service discovery refresh failures.", |
||||
}), |
||||
cacheHitCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_azure_cache_hit_total", |
||||
Help: "Number of cache hit during refresh.", |
||||
}), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.failuresCount, |
||||
m.cacheHitCount, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *azureMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *azureMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,73 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 consul |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*consulMetrics)(nil) |
||||
|
||||
type consulMetrics struct { |
||||
rpcFailuresCount prometheus.Counter |
||||
rpcDuration *prometheus.SummaryVec |
||||
|
||||
servicesRPCDuration prometheus.Observer |
||||
serviceRPCDuration prometheus.Observer |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &consulMetrics{ |
||||
rpcFailuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_consul_rpc_failures_total", |
||||
Help: "The number of Consul RPC call failures.", |
||||
}), |
||||
rpcDuration: prometheus.NewSummaryVec( |
||||
prometheus.SummaryOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_consul_rpc_duration_seconds", |
||||
Help: "The duration of a Consul RPC call in seconds.", |
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
||||
}, |
||||
[]string{"endpoint", "call"}, |
||||
), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.rpcFailuresCount, |
||||
m.rpcDuration, |
||||
}) |
||||
|
||||
// Initialize metric vectors.
|
||||
m.servicesRPCDuration = m.rpcDuration.WithLabelValues("catalog", "services") |
||||
m.serviceRPCDuration = m.rpcDuration.WithLabelValues("catalog", "service") |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *consulMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *consulMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 digitalocean |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*digitaloceanMetrics)(nil) |
||||
|
||||
type digitaloceanMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *digitaloceanMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *digitaloceanMetrics) Unregister() {} |
@ -0,0 +1,28 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 discovery |
||||
|
||||
// Create a dummy metrics struct, because this SD doesn't have any metrics.
|
||||
type NoopDiscovererMetrics struct{} |
||||
|
||||
var _ DiscovererMetrics = (*NoopDiscovererMetrics)(nil) |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (*NoopDiscovererMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (*NoopDiscovererMetrics) Unregister() { |
||||
} |
@ -0,0 +1,66 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 dns |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*dnsMetrics)(nil) |
||||
|
||||
type dnsMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
|
||||
dnsSDLookupsCount prometheus.Counter |
||||
dnsSDLookupFailuresCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &dnsMetrics{ |
||||
refreshMetrics: rmi, |
||||
dnsSDLookupsCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_dns_lookups_total", |
||||
Help: "The number of DNS-SD lookups.", |
||||
}), |
||||
dnsSDLookupFailuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_dns_lookup_failures_total", |
||||
Help: "The number of DNS-SD lookup failures.", |
||||
}), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.dnsSDLookupsCount, |
||||
m.dnsSDLookupFailuresCount, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *dnsMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *dnsMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 eureka |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*eurekaMetrics)(nil) |
||||
|
||||
type eurekaMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *eurekaMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *eurekaMetrics) Unregister() {} |
@ -0,0 +1,76 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 file |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*fileMetrics)(nil) |
||||
|
||||
type fileMetrics struct { |
||||
fileSDReadErrorsCount prometheus.Counter |
||||
fileSDScanDuration prometheus.Summary |
||||
fileWatcherErrorsCount prometheus.Counter |
||||
fileSDTimeStamp *TimestampCollector |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
fm := &fileMetrics{ |
||||
fileSDReadErrorsCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_file_read_errors_total", |
||||
Help: "The number of File-SD read errors.", |
||||
}), |
||||
fileSDScanDuration: prometheus.NewSummary( |
||||
prometheus.SummaryOpts{ |
||||
Name: "prometheus_sd_file_scan_duration_seconds", |
||||
Help: "The duration of the File-SD scan in seconds.", |
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
||||
}), |
||||
fileWatcherErrorsCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_file_watcher_errors_total", |
||||
Help: "The number of File-SD errors caused by filesystem watch failures.", |
||||
}), |
||||
fileSDTimeStamp: NewTimestampCollector(), |
||||
} |
||||
|
||||
fm.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
fm.fileSDReadErrorsCount, |
||||
fm.fileSDScanDuration, |
||||
fm.fileWatcherErrorsCount, |
||||
fm.fileSDTimeStamp, |
||||
}) |
||||
|
||||
return fm |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (fm *fileMetrics) Register() error { |
||||
return fm.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (fm *fileMetrics) Unregister() { |
||||
fm.metricRegisterer.UnregisterMetrics() |
||||
} |
||||
|
||||
func (fm *fileMetrics) init(disc *Discovery) { |
||||
fm.fileSDTimeStamp.addDiscoverer(disc) |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 gce |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*gceMetrics)(nil) |
||||
|
||||
type gceMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *gceMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *gceMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 hetzner |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*hetznerMetrics)(nil) |
||||
|
||||
type hetznerMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *hetznerMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *hetznerMetrics) Unregister() {} |
@ -0,0 +1,57 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 http |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*httpMetrics)(nil) |
||||
|
||||
type httpMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
|
||||
failuresCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &httpMetrics{ |
||||
refreshMetrics: rmi, |
||||
failuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_http_failures_total", |
||||
Help: "Number of HTTP service discovery refresh failures.", |
||||
}), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.failuresCount, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *httpMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *httpMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 ionos |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*ionosMetrics)(nil) |
||||
|
||||
type ionosMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *ionosMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *ionosMetrics) Unregister() {} |
@ -0,0 +1,75 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 kubernetes |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*kubernetesMetrics)(nil) |
||||
|
||||
type kubernetesMetrics struct { |
||||
eventCount *prometheus.CounterVec |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &kubernetesMetrics{ |
||||
eventCount: prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: discovery.KubernetesMetricsNamespace, |
||||
Name: "events_total", |
||||
Help: "The number of Kubernetes events handled.", |
||||
}, |
||||
[]string{"role", "event"}, |
||||
), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.eventCount, |
||||
}) |
||||
|
||||
// Initialize metric vectors.
|
||||
for _, role := range []string{ |
||||
RoleEndpointSlice.String(), |
||||
RoleEndpoint.String(), |
||||
RoleNode.String(), |
||||
RolePod.String(), |
||||
RoleService.String(), |
||||
RoleIngress.String(), |
||||
} { |
||||
for _, evt := range []string{ |
||||
MetricLabelRoleAdd, |
||||
MetricLabelRoleDelete, |
||||
MetricLabelRoleUpdate, |
||||
} { |
||||
m.eventCount.WithLabelValues(role, evt) |
||||
} |
||||
} |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *kubernetesMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *kubernetesMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,57 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 linode |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*linodeMetrics)(nil) |
||||
|
||||
type linodeMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
|
||||
failuresCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &linodeMetrics{ |
||||
refreshMetrics: rmi, |
||||
failuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_linode_failures_total", |
||||
Help: "Number of Linode service discovery refresh failures.", |
||||
}), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.failuresCount, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *linodeMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *linodeMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 marathon |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*marathonMetrics)(nil) |
||||
|
||||
type marathonMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *marathonMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *marathonMetrics) Unregister() {} |
@ -0,0 +1,75 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 discovery |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
) |
||||
|
||||
// Metric vectors for the "refresh" package.
|
||||
// We define them here in the "discovery" package in order to avoid a cyclic dependency between
|
||||
// "discovery" and "refresh".
|
||||
type RefreshMetricsVecs struct { |
||||
failuresVec *prometheus.CounterVec |
||||
durationVec *prometheus.SummaryVec |
||||
|
||||
metricRegisterer MetricRegisterer |
||||
} |
||||
|
||||
var _ RefreshMetricsManager = (*RefreshMetricsVecs)(nil) |
||||
|
||||
func NewRefreshMetrics(reg prometheus.Registerer) RefreshMetricsManager { |
||||
m := &RefreshMetricsVecs{ |
||||
failuresVec: prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_refresh_failures_total", |
||||
Help: "Number of refresh failures for the given SD mechanism.", |
||||
}, |
||||
[]string{"mechanism"}), |
||||
durationVec: prometheus.NewSummaryVec( |
||||
prometheus.SummaryOpts{ |
||||
Name: "prometheus_sd_refresh_duration_seconds", |
||||
Help: "The duration of a refresh in seconds for the given SD mechanism.", |
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
||||
}, |
||||
[]string{"mechanism"}), |
||||
} |
||||
|
||||
// The reason we register metric vectors instead of metrics is so that
|
||||
// the metrics are not visible until they are recorded.
|
||||
m.metricRegisterer = NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.failuresVec, |
||||
m.durationVec, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Instantiate returns metrics out of metric vectors.
|
||||
func (m *RefreshMetricsVecs) Instantiate(mech string) *RefreshMetrics { |
||||
return &RefreshMetrics{ |
||||
Failures: m.failuresVec.WithLabelValues(mech), |
||||
Duration: m.durationVec.WithLabelValues(mech), |
||||
} |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *RefreshMetricsVecs) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *RefreshMetricsVecs) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 moby |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*dockerMetrics)(nil) |
||||
|
||||
type dockerMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *dockerMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *dockerMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 moby |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*dockerswarmMetrics)(nil) |
||||
|
||||
type dockerswarmMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *dockerswarmMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *dockerswarmMetrics) Unregister() {} |
@ -0,0 +1,57 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 nomad |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*nomadMetrics)(nil) |
||||
|
||||
type nomadMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
|
||||
failuresCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &nomadMetrics{ |
||||
refreshMetrics: rmi, |
||||
failuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Name: "prometheus_sd_nomad_failures_total", |
||||
Help: "Number of nomad service discovery refresh failures.", |
||||
}), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.failuresCount, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *nomadMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *nomadMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 openstack |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
type openstackMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
var _ discovery.DiscovererMetrics = (*openstackMetrics)(nil) |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *openstackMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *openstackMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 ovhcloud |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*ovhcloudMetrics)(nil) |
||||
|
||||
type ovhcloudMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *ovhcloudMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *ovhcloudMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 puppetdb |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*puppetdbMetrics)(nil) |
||||
|
||||
type puppetdbMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *puppetdbMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *puppetdbMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 scaleway |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*scalewayMetrics)(nil) |
||||
|
||||
type scalewayMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *scalewayMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *scalewayMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 triton |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*tritonMetrics)(nil) |
||||
|
||||
type tritonMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *tritonMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *tritonMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 uyuni |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*uyuniMetrics)(nil) |
||||
|
||||
type uyuniMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *uyuniMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *uyuniMetrics) Unregister() {} |
@ -0,0 +1,32 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 vultr |
||||
|
||||
import ( |
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*vultrMetrics)(nil) |
||||
|
||||
type vultrMetrics struct { |
||||
refreshMetrics discovery.RefreshMetricsInstantiator |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *vultrMetrics) Register() error { |
||||
return nil |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *vultrMetrics) Unregister() {} |
@ -0,0 +1,73 @@
|
||||
// Copyright 2015 The Prometheus Authors
|
||||
// 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,
|
||||
// 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 xds |
||||
|
||||
import ( |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
|
||||
"github.com/prometheus/prometheus/discovery" |
||||
) |
||||
|
||||
var _ discovery.DiscovererMetrics = (*xdsMetrics)(nil) |
||||
|
||||
type xdsMetrics struct { |
||||
fetchDuration prometheus.Summary |
||||
fetchSkipUpdateCount prometheus.Counter |
||||
fetchFailuresCount prometheus.Counter |
||||
|
||||
metricRegisterer discovery.MetricRegisterer |
||||
} |
||||
|
||||
func newDiscovererMetrics(reg prometheus.Registerer, rmi discovery.RefreshMetricsInstantiator) discovery.DiscovererMetrics { |
||||
m := &xdsMetrics{ |
||||
fetchFailuresCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_kuma_fetch_failures_total", |
||||
Help: "The number of Kuma MADS fetch call failures.", |
||||
}), |
||||
fetchSkipUpdateCount: prometheus.NewCounter( |
||||
prometheus.CounterOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_kuma_fetch_skipped_updates_total", |
||||
Help: "The number of Kuma MADS fetch calls that result in no updates to the targets.", |
||||
}), |
||||
fetchDuration: prometheus.NewSummary( |
||||
prometheus.SummaryOpts{ |
||||
Namespace: namespace, |
||||
Name: "sd_kuma_fetch_duration_seconds", |
||||
Help: "The duration of a Kuma MADS fetch call.", |
||||
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, |
||||
}, |
||||
), |
||||
} |
||||
|
||||
m.metricRegisterer = discovery.NewMetricRegisterer(reg, []prometheus.Collector{ |
||||
m.fetchFailuresCount, |
||||
m.fetchSkipUpdateCount, |
||||
m.fetchDuration, |
||||
}) |
||||
|
||||
return m |
||||
} |
||||
|
||||
// Register implements discovery.DiscovererMetrics.
|
||||
func (m *xdsMetrics) Register() error { |
||||
return m.metricRegisterer.RegisterMetrics() |
||||
} |
||||
|
||||
// Unregister implements discovery.DiscovererMetrics.
|
||||
func (m *xdsMetrics) Unregister() { |
||||
m.metricRegisterer.UnregisterMetrics() |
||||
} |
Loading…
Reference in new issue