updating Go names to not use underscores

This commit is contained in:
Benjamin Visser 2018-01-17 13:15:16 -05:00
parent 6b9993b3d0
commit 2ae1878ef4

View file

@ -33,9 +33,9 @@ type (
} }
nginxStatusData struct { nginxStatusData struct {
connections_total *prometheus.Desc connectionsTotal *prometheus.Desc
requests *prometheus.Desc requestsTotal *prometheus.Desc
connections *prometheus.Desc connections *prometheus.Desc
} }
) )
@ -51,12 +51,12 @@ func NewNginxStatus(watchNamespace, ingressClass string, ngxHealthPort int, ngxV
} }
p.data = &nginxStatusData{ p.data = &nginxStatusData{
connections_total: prometheus.NewDesc( connectionsTotal: prometheus.NewDesc(
prometheus.BuildFQName(ns, "", "connections_total"), prometheus.BuildFQName(ns, "", "connections_total"),
"total number of connections with state {active, accepted, handled}", "total number of connections with state {active, accepted, handled}",
[]string{"ingress_class", "namespace", "state"}, nil), []string{"ingress_class", "namespace", "state"}, nil),
requests_total: prometheus.NewDesc( requestsTotal: prometheus.NewDesc(
prometheus.BuildFQName(ns, "", "requests_total"), prometheus.BuildFQName(ns, "", "requests_total"),
"total number of client requests", "total number of client requests",
[]string{"ingress_class", "namespace"}, nil), []string{"ingress_class", "namespace"}, nil),
@ -74,8 +74,8 @@ func NewNginxStatus(watchNamespace, ingressClass string, ngxHealthPort int, ngxV
// Describe implements prometheus.Collector. // Describe implements prometheus.Collector.
func (p nginxStatusCollector) Describe(ch chan<- *prometheus.Desc) { func (p nginxStatusCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- p.data.connections_total ch <- p.data.connectionsTotal
ch <- p.data.requests_total ch <- p.data.requestsTotal
ch <- p.data.connections ch <- p.data.connections
} }
@ -106,13 +106,13 @@ func (p nginxStatusCollector) scrape(ch chan<- prometheus.Metric) {
return return
} }
ch <- prometheus.MustNewConstMetric(p.data.connections_total, ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
prometheus.CounterValue, float64(s.Active), p.ingressClass, p.watchNamespace, "active") prometheus.CounterValue, float64(s.Active), p.ingressClass, p.watchNamespace, "active")
ch <- prometheus.MustNewConstMetric(p.data.connections_total, ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
prometheus.CounterValue, float64(s.Accepted), p.ingressClass, p.watchNamespace, "accepted") prometheus.CounterValue, float64(s.Accepted), p.ingressClass, p.watchNamespace, "accepted")
ch <- prometheus.MustNewConstMetric(p.data.connections_total, ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
prometheus.CounterValue, float64(s.Handled), p.ingressClass, p.watchNamespace, "handled") prometheus.CounterValue, float64(s.Handled), p.ingressClass, p.watchNamespace, "handled")
ch <- prometheus.MustNewConstMetric(p.data.requests_total, ch <- prometheus.MustNewConstMetric(p.data.requestsTotal,
prometheus.CounterValue, float64(s.Requests), p.ingressClass, p.watchNamespace) prometheus.CounterValue, float64(s.Requests), p.ingressClass, p.watchNamespace)
ch <- prometheus.MustNewConstMetric(p.data.connections, ch <- prometheus.MustNewConstMetric(p.data.connections,
prometheus.GaugeValue, float64(s.Reading), pconnections.ingressClass, p.watchNamespace, "reading") prometheus.GaugeValue, float64(s.Reading), pconnections.ingressClass, p.watchNamespace, "reading")