Merge f4a6cbc4d4
into ab3afe562d
This commit is contained in:
commit
2641a18734
4 changed files with 46 additions and 26 deletions
|
@ -81,6 +81,7 @@ type filterZone struct {
|
||||||
InBytes float64 `json:"inBytes"`
|
InBytes float64 `json:"inBytes"`
|
||||||
OutBytes float64 `json:"outBytes"`
|
OutBytes float64 `json:"outBytes"`
|
||||||
Cache cache `json:"cache"`
|
Cache cache `json:"cache"`
|
||||||
|
RequestMsec float64 `json:"requestMsec"`
|
||||||
Responses response `json:"responses"`
|
Responses response `json:"responses"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ type (
|
||||||
requests *prometheus.Desc
|
requests *prometheus.Desc
|
||||||
filterZoneBytes *prometheus.Desc
|
filterZoneBytes *prometheus.Desc
|
||||||
filterZoneResponses *prometheus.Desc
|
filterZoneResponses *prometheus.Desc
|
||||||
|
filterZoneRequestMsec *prometheus.Desc
|
||||||
filterZoneCache *prometheus.Desc
|
filterZoneCache *prometheus.Desc
|
||||||
upstreamBackup *prometheus.Desc
|
upstreamBackup *prometheus.Desc
|
||||||
upstreamBytes *prometheus.Desc
|
upstreamBytes *prometheus.Desc
|
||||||
|
@ -97,17 +98,22 @@ func NewNGINXVTSCollector(watchNamespace, ingressClass string, port int, path st
|
||||||
filterZoneBytes: prometheus.NewDesc(
|
filterZoneBytes: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(ns, "", "filterzone_bytes_total"),
|
prometheus.BuildFQName(ns, "", "filterzone_bytes_total"),
|
||||||
"Nginx bytes count",
|
"Nginx bytes count",
|
||||||
[]string{"ingress_class", "namespace", "server_zone", "key", "direction"}, nil),
|
[]string{"ingress_class", "namespace", "server_zone", "country", "filter_name", "filter_key", "direction"}, nil),
|
||||||
|
|
||||||
filterZoneResponses: prometheus.NewDesc(
|
filterZoneResponses: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(ns, "", "filterzone_responses_total"),
|
prometheus.BuildFQName(ns, "", "filterzone_responses_total"),
|
||||||
"The number of responses with status codes 1xx, 2xx, 3xx, 4xx, and 5xx.",
|
"The number of responses with status codes 1xx, 2xx, 3xx, 4xx, and 5xx.",
|
||||||
[]string{"ingress_class", "namespace", "server_zone", "key", "status_code"}, nil),
|
[]string{"ingress_class", "namespace", "server_zone", "country", "filter_name", "filter_key", "status_code"}, nil),
|
||||||
|
|
||||||
|
filterZoneRequestMsec: prometheus.NewDesc(
|
||||||
|
prometheus.BuildFQName(ns, "", "filterzone_request_msecs_avg"),
|
||||||
|
"The average of only filter zone request processing times in milliseconds.",
|
||||||
|
[]string{"ingress_class", "namespace", "server_zone", "country", "filter_name", "filter_key"}, nil),
|
||||||
|
|
||||||
filterZoneCache: prometheus.NewDesc(
|
filterZoneCache: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(ns, "", "filterzone_cache_total"),
|
prometheus.BuildFQName(ns, "", "filterzone_cache_total"),
|
||||||
"Nginx cache count",
|
"Nginx cache count",
|
||||||
[]string{"ingress_class", "namespace", "server_zone", "key", "type"}, nil),
|
[]string{"ingress_class", "namespace", "server_zone", "country", "filter_name", "filter_key", "type"}, nil),
|
||||||
|
|
||||||
upstreamBackup: prometheus.NewDesc(
|
upstreamBackup: prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(ns, "", "upstream_backup"),
|
prometheus.BuildFQName(ns, "", "upstream_backup"),
|
||||||
|
@ -247,15 +253,17 @@ func (p vtsCollector) scrapeVts(ch chan<- prometheus.Metric) {
|
||||||
prometheus.CounterValue, zone.OutBytes, p.ingressClass, p.watchNamespace, name, "out")
|
prometheus.CounterValue, zone.OutBytes, p.ingressClass, p.watchNamespace, name, "out")
|
||||||
}
|
}
|
||||||
|
|
||||||
for serverZone, keys := range nginxMetrics.FilterZones {
|
for filterName, filterKeys := range nginxMetrics.FilterZones {
|
||||||
for name, zone := range keys {
|
for filterKey, zone := range filterKeys {
|
||||||
reflectMetrics(&zone.Responses, p.data.filterZoneResponses, ch, p.ingressClass, p.watchNamespace, serverZone, name)
|
reflectMetrics(&zone.Responses, p.data.filterZoneResponses, ch, p.ingressClass, p.watchNamespace, filterName, filterKey, filterName, filterKey)
|
||||||
reflectMetrics(&zone.Cache, p.data.filterZoneCache, ch, p.ingressClass, p.watchNamespace, serverZone, name)
|
reflectMetrics(&zone.Cache, p.data.filterZoneCache, ch, p.ingressClass, p.watchNamespace, filterName, filterKey, filterName, filterKey)
|
||||||
|
|
||||||
|
ch <- prometheus.MustNewConstMetric(p.data.filterZoneRequestMsec,
|
||||||
|
prometheus.CounterValue, zone.RequestMsec, p.ingressClass, p.watchNamespace, filterName, filterKey, filterName, filterKey)
|
||||||
ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
|
ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
|
||||||
prometheus.CounterValue, zone.InBytes, p.ingressClass, p.watchNamespace, serverZone, name, "in")
|
prometheus.CounterValue, zone.InBytes, p.ingressClass, p.watchNamespace, filterName, filterKey, filterName, filterKey, "in")
|
||||||
ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
|
ch <- prometheus.MustNewConstMetric(p.data.filterZoneBytes,
|
||||||
prometheus.CounterValue, zone.OutBytes, p.ingressClass, p.watchNamespace, serverZone, name, "out")
|
prometheus.CounterValue, zone.OutBytes, p.ingressClass, p.watchNamespace, filterName, filterKey, filterName, filterKey, "out")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -783,6 +783,16 @@ stream {
|
||||||
proxy_set_header Accept-Encoding "";
|
proxy_set_header Accept-Encoding "";
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $all.Cfg.EnableVtsStatus }}
|
||||||
|
{{ if $location.Service }}
|
||||||
|
vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }} kubernetes::namespace;
|
||||||
|
vhost_traffic_status_filter_by_set_key {{ $location.Service.ObjectMeta.Namespace }}.{{ $location.Service.ObjectMeta.Name }} kubernetes::service;
|
||||||
|
{{ end }}
|
||||||
|
{{ if $location.Ingress }}
|
||||||
|
vhost_traffic_status_filter_by_set_key {{ $location.Ingress.ObjectMeta.Namespace }}.{{ $location.Ingress.ObjectMeta.Name }} kubernetes::ingress;
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{/* Add any additional configuration defined */}}
|
{{/* Add any additional configuration defined */}}
|
||||||
{{ $location.ConfigurationSnippet }}
|
{{ $location.ConfigurationSnippet }}
|
||||||
|
|
||||||
|
|
|
@ -970,6 +970,7 @@ func (ic *GenericController) createServers(data []*extensions.Ingress,
|
||||||
Backend: un,
|
Backend: un,
|
||||||
Proxy: ngxProxy,
|
Proxy: ngxProxy,
|
||||||
Service: &apiv1.Service{},
|
Service: &apiv1.Service{},
|
||||||
|
Ingress: ing,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SSLPassthrough: sslpt,
|
SSLPassthrough: sslpt,
|
||||||
|
|
Loading…
Reference in a new issue