mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-06 17:57: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
|
|
@ -2,10 +2,11 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/directxman12/k8s-prometheus-adapter/pkg/metrics"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
// FromFile loads the configuration from a particular file.
|
||||
|
|
@ -28,5 +29,7 @@ func FromYAML(contents []byte) (*MetricsDiscoveryConfig, error) {
|
|||
if err := yaml.UnmarshalStrict(contents, &cfg); err != nil {
|
||||
return nil, fmt.Errorf("unable to parse metrics discovery config: %v", err)
|
||||
}
|
||||
metrics.Rules.WithLabelValues("normal").Set(float64(len(cfg.Rules)))
|
||||
metrics.Rules.WithLabelValues("external").Set(float64(len(cfg.ExternalRules)))
|
||||
return &cfg, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue