Update metric dependencies (#5023)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-06 09:50:13 -03:00 committed by GitHub
parent 4befa8cc8a
commit 9278f0cad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
128 changed files with 3873 additions and 2729 deletions

View file

@ -38,6 +38,13 @@ type Stopable interface {
Stop()
}
func newBinaryNameMatcher(name, binary string) common.MatchNamer {
return BinaryNameMatcher{
Name: name,
Binary: binary,
}
}
// BinaryNameMatcher define a namer using the binary name
type BinaryNameMatcher struct {
Name string
@ -97,14 +104,11 @@ func NewNGINXProcess(pod, namespace, ingressClass string) (NGINXProcessCollector
return nil, err
}
nm := BinaryNameMatcher{
Name: name,
Binary: binary,
}
nm := newBinaryNameMatcher(name, binary)
p := namedProcess{
scrapeChan: make(chan scrapeRequest),
Grouper: proc.NewGrouper(nm, true, false, false),
Grouper: proc.NewGrouper(nm, true, false, false, false),
fs: fs,
}

View file

@ -94,12 +94,16 @@ var (
}
)
// DefObjectives was removed in https://github.com/prometheus/client_golang/pull/262
// updating the library to latest version changed the output of the metrics
var defObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}
// NewSocketCollector creates a new SocketCollector instance using
// the ingress watch namespace and class used by the controller
func NewSocketCollector(pod, namespace, class string, metricsPerHost bool) (*SocketCollector, error) {
socket := "/tmp/prometheus-nginx.socket"
// unix sockets must be unlink()ed before being used
syscall.Unlink(socket)
_ = syscall.Unlink(socket)
listener, err := net.Listen("unix", socket)
if err != nil {
@ -193,6 +197,7 @@ func NewSocketCollector(pod, namespace, class string, metricsPerHost bool) (*Soc
Help: "Upstream service latency per Ingress",
Namespace: PrometheusNamespace,
ConstLabels: constLabels,
Objectives: defObjectives,
},
[]string{"ingress", "namespace", "service"},
),