Metrics: Remove ingress_upstream_latency_seconds
. (#11795)
Signed-off-by: joey <zchengjoey@gmail.com>
This commit is contained in:
parent
d70b849d25
commit
eee2760907
2 changed files with 4 additions and 56 deletions
|
@ -386,10 +386,6 @@ Prometheus metrics are exposed on port 10254.
|
||||||
The number of bytes sent to a client. **Deprecated**, use `nginx_ingress_controller_response_size`\
|
The number of bytes sent to a client. **Deprecated**, use `nginx_ingress_controller_response_size`\
|
||||||
nginx var: `bytes_sent`
|
nginx var: `bytes_sent`
|
||||||
|
|
||||||
* `nginx_ingress_controller_ingress_upstream_latency_seconds` Summary\
|
|
||||||
Upstream service latency per Ingress. **Deprecated**, use `nginx_ingress_controller_connect_duration_seconds`\
|
|
||||||
nginx var: `upstream_connect_time`
|
|
||||||
|
|
||||||
```
|
```
|
||||||
# HELP nginx_ingress_controller_bytes_sent The number of bytes sent to a client. DEPRECATED! Use nginx_ingress_controller_response_size
|
# HELP nginx_ingress_controller_bytes_sent The number of bytes sent to a client. DEPRECATED! Use nginx_ingress_controller_response_size
|
||||||
# TYPE nginx_ingress_controller_bytes_sent histogram
|
# TYPE nginx_ingress_controller_bytes_sent histogram
|
||||||
|
@ -397,8 +393,6 @@ Prometheus metrics are exposed on port 10254.
|
||||||
# TYPE nginx_ingress_controller_connect_duration_seconds nginx_ingress_controller_connect_duration_seconds
|
# TYPE nginx_ingress_controller_connect_duration_seconds nginx_ingress_controller_connect_duration_seconds
|
||||||
* HELP nginx_ingress_controller_header_duration_seconds The time spent on receiving first header from the upstream server
|
* HELP nginx_ingress_controller_header_duration_seconds The time spent on receiving first header from the upstream server
|
||||||
# TYPE nginx_ingress_controller_header_duration_seconds histogram
|
# TYPE nginx_ingress_controller_header_duration_seconds histogram
|
||||||
# HELP nginx_ingress_controller_ingress_upstream_latency_seconds Upstream service latency per Ingress DEPRECATED! Use nginx_ingress_controller_connect_duration_seconds
|
|
||||||
# TYPE nginx_ingress_controller_ingress_upstream_latency_seconds summary
|
|
||||||
# HELP nginx_ingress_controller_request_duration_seconds The request processing time in milliseconds
|
# HELP nginx_ingress_controller_request_duration_seconds The request processing time in milliseconds
|
||||||
# TYPE nginx_ingress_controller_request_duration_seconds histogram
|
# TYPE nginx_ingress_controller_request_duration_seconds histogram
|
||||||
# HELP nginx_ingress_controller_request_size The request length (including request line, header, and request body)
|
# HELP nginx_ingress_controller_request_size The request length (including request line, header, and request body)
|
||||||
|
|
|
@ -64,7 +64,6 @@ type metricMapping map[string]prometheus.Collector
|
||||||
type SocketCollector struct {
|
type SocketCollector struct {
|
||||||
prometheus.Collector
|
prometheus.Collector
|
||||||
|
|
||||||
upstreamLatency *prometheus.SummaryVec // TODO: DEPRECATED, remove
|
|
||||||
connectTime *prometheus.HistogramVec
|
connectTime *prometheus.HistogramVec
|
||||||
headerTime *prometheus.HistogramVec
|
headerTime *prometheus.HistogramVec
|
||||||
requestTime *prometheus.HistogramVec
|
requestTime *prometheus.HistogramVec
|
||||||
|
@ -98,10 +97,6 @@ var requestTags = []string{
|
||||||
"canary",
|
"canary",
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// NewSocketCollector creates a new SocketCollector instance using
|
||||||
// the ingress watch namespace and class used by the controller
|
// the ingress watch namespace and class used by the controller
|
||||||
func NewSocketCollector(pod, namespace, class string, metricsPerHost, reportStatusClasses bool, buckets HistogramBuckets, excludeMetrics []string) (*SocketCollector, error) {
|
func NewSocketCollector(pod, namespace, class string, metricsPerHost, reportStatusClasses bool, buckets HistogramBuckets, excludeMetrics []string) (*SocketCollector, error) {
|
||||||
|
@ -248,19 +243,6 @@ func NewSocketCollector(pod, namespace, class string, metricsPerHost, reportStat
|
||||||
em,
|
em,
|
||||||
mm,
|
mm,
|
||||||
),
|
),
|
||||||
|
|
||||||
upstreamLatency: summaryMetric(
|
|
||||||
&prometheus.SummaryOpts{
|
|
||||||
Name: "ingress_upstream_latency_seconds",
|
|
||||||
Help: "DEPRECATED Upstream service latency per Ingress",
|
|
||||||
Namespace: PrometheusNamespace,
|
|
||||||
ConstLabels: constLabels,
|
|
||||||
Objectives: defObjectives,
|
|
||||||
},
|
|
||||||
[]string{"ingress", "namespace", "service", "canary"},
|
|
||||||
em,
|
|
||||||
mm,
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.metricMapping = mm
|
sc.metricMapping = mm
|
||||||
|
@ -275,18 +257,6 @@ func containsMetric(excludeMetrics map[string]struct{}, name string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func summaryMetric(opts *prometheus.SummaryOpts, requestTags []string, excludeMetrics map[string]struct{}, metricMapping metricMapping) *prometheus.SummaryVec {
|
|
||||||
if containsMetric(excludeMetrics, opts.Name) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
m := prometheus.NewSummaryVec(
|
|
||||||
*opts,
|
|
||||||
requestTags,
|
|
||||||
)
|
|
||||||
metricMapping[prometheus.BuildFQName(PrometheusNamespace, "", opts.Name)] = m
|
|
||||||
return m
|
|
||||||
}
|
|
||||||
|
|
||||||
func counterMetric(opts *prometheus.CounterOpts, requestTags []string, excludeMetrics map[string]struct{}, metricMapping metricMapping) *prometheus.CounterVec {
|
func counterMetric(opts *prometheus.CounterOpts, requestTags []string, excludeMetrics map[string]struct{}, metricMapping metricMapping) *prometheus.CounterVec {
|
||||||
if containsMetric(excludeMetrics, opts.Name) {
|
if containsMetric(excludeMetrics, opts.Name) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -358,13 +328,6 @@ func (sc *SocketCollector) handleMessage(msg []byte) {
|
||||||
collectorLabels["host"] = stats.Host
|
collectorLabels["host"] = stats.Host
|
||||||
}
|
}
|
||||||
|
|
||||||
latencyLabels := prometheus.Labels{
|
|
||||||
"namespace": stats.Namespace,
|
|
||||||
"ingress": stats.Ingress,
|
|
||||||
"service": stats.Service,
|
|
||||||
"canary": stats.Canary,
|
|
||||||
}
|
|
||||||
|
|
||||||
if sc.requests != nil {
|
if sc.requests != nil {
|
||||||
requestsMetric, err := sc.requests.GetMetricWith(collectorLabels)
|
requestsMetric, err := sc.requests.GetMetricWith(collectorLabels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -383,15 +346,6 @@ func (sc *SocketCollector) handleMessage(msg []byte) {
|
||||||
connectTimeMetric.Observe(stats.Latency)
|
connectTimeMetric.Observe(stats.Latency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if sc.upstreamLatency != nil {
|
|
||||||
latencyMetric, err := sc.upstreamLatency.GetMetricWith(latencyLabels)
|
|
||||||
if err != nil {
|
|
||||||
klog.ErrorS(err, "Error fetching latency metric")
|
|
||||||
} else {
|
|
||||||
latencyMetric.Observe(stats.Latency)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if stats.HeaderTime != -1 && sc.headerTime != nil {
|
if stats.HeaderTime != -1 && sc.headerTime != nil {
|
||||||
|
|
Loading…
Reference in a new issue