mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 10:17:51 +00:00
instrument k8s-prometheus-adapter to expose prometheus metrics
fixes #218
This commit is contained in:
parent
28a807aa9f
commit
cbba53e16b
11 changed files with 308 additions and 14 deletions
|
|
@ -14,6 +14,7 @@ limitations under the License.
|
|||
package provider
|
||||
|
||||
import (
|
||||
"github.com/directxman12/k8s-prometheus-adapter/pkg/metrics"
|
||||
"sync"
|
||||
|
||||
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/provider"
|
||||
|
|
@ -34,6 +35,9 @@ type ExternalSeriesRegistry interface {
|
|||
|
||||
// overridableSeriesRegistry is a basic SeriesRegistry
|
||||
type externalSeriesRegistry struct {
|
||||
// registry name is used for metrics &c
|
||||
name string
|
||||
|
||||
// We lock when reading/writing metrics, and metricsInfo to prevent inconsistencies.
|
||||
mu sync.RWMutex
|
||||
|
||||
|
|
@ -100,6 +104,7 @@ func (r *externalSeriesRegistry) filterAndStoreMetrics(result MetricUpdateResult
|
|||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
|
||||
metrics.RegistryMetrics.WithLabelValues(r.name).Set(float64(len(apiMetricsCache)))
|
||||
r.metrics = apiMetricsCache
|
||||
r.metricsInfo = rawMetricsCache
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue