-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexporter.go
46 lines (40 loc) · 1.03 KB
/
exporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"net/url"
"sync"
"github.com/prometheus/client_golang/prometheus"
)
// Exporter Sets up all the runtime and metrics
type Exporter struct {
APIServer *url.URL
BasicAuth *BasicAuth
BearerToken string
BearerTokenFile string
TLSConfig *TLSConfig
mutex sync.RWMutex
gaugeVecs map[string]*prometheus.GaugeVec
}
func newExporter(APIServer *url.URL, BearerToken string, BearerTokenFile string, TLSConfig *TLSConfig) *Exporter {
gaugeVecs := addMetrics()
return &Exporter{
APIServer: APIServer,
BearerToken: BearerToken,
BearerTokenFile: BearerTokenFile,
TLSConfig: TLSConfig,
gaugeVecs: gaugeVecs,
}
}
// TLSConfig kubernates client tls config
type TLSConfig struct {
CAFile string
CertFile string
KeyFile string
ServerName string
InsecureSkipVerify bool
XXX map[string]interface{}
}
// BasicAuth kubernates client basic auth
type BasicAuth struct {
Username string
Password string
}