Skip to content

Commit e3dc777

Browse files
committed
Lint code. Improve docs.
1 parent 6984981 commit e3dc777

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

docs-web/logging-and-monitoring/prometheus.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ The Ingress Controller exports the following metrics:
3737
* `controller_ingress_resources_total`. Number of handled Ingress resources. This metric includes the label type, that groups the Ingress resources by their type (regular, [minion or master](/nginx-ingress-controller/configuration/ingress-resources/cross-namespace-configuration)). **Note**: The metric doesn't count minions without a master.
3838
* `controller_virtualserver_resources_total`. Number of handled VirtualServer resources.
3939
* `controller_virtualserverroute_resources_total`. Number of handled VirtualServerRoute resources. **Note**: The metric counts only VirtualServerRoutes that have a reference from a VirtualServer.
40-
* Kubernetes Cluster metrics
41-
* `controller_workqueue_depth` Current depth of workqueue.
42-
* `controller_workqueue_queue_duration_second`. How long in seconds an item stays in workqueue before being requested.
43-
* `controller_workqueue_work_duration_seconds`. How long in seconds processing an item from workqueue takes.
40+
* Workqueue metrics. **Note**: the workqueue is a queue used by the Ingress Controller to process changes to the relevant resources in the cluster like Ingress resources. The Ingress Controller uses only one queue. The metrics for that queue will have the label `name="taskQueue"`
41+
* `workqueue_depth`. Current depth of the workqueue.
42+
* `workqueue_queue_duration_second`. How long in seconds an item stays in the workqueue before being requested.
43+
* `workqueue_work_duration_seconds`. How long in seconds processing an item from the workqueue takes.
4444

45-
46-
**Note**: all metrics have the namespace nginx_ingress. For example, nginx_ingress_controller_nginx_reloads_total.
45+
**Note**: all metrics have the namespace `nginx_ingress`. For example, `nginx_ingress_controller_nginx_reloads_total`.
4746

4847
**Note**: all metrics include the label `class`, which is set to the class of the Ingress Controller. The class is configured via the `-ingress-class` command-line argument.

internal/metrics/collectors/processes.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ import (
1010
"github.com/prometheus/client_golang/prometheus"
1111
)
1212

13-
// NginxProcessesMetricsCollector implements NginxProcessesCollector interface and prometheus.Collector interface
13+
// NginxProcessesMetricsCollector implements prometheus.Collector interface
1414
type NginxProcessesMetricsCollector struct {
15-
// Metrics
1615
workerProcessTotal *prometheus.GaugeVec
1716
}
1817

1918
// NewNginxProcessesMetricsCollector creates a new NginxProcessMetricsCollector
2019
func NewNginxProcessesMetricsCollector(constLabels map[string]string) *NginxProcessesMetricsCollector {
21-
pc := &NginxProcessesMetricsCollector{
20+
return &NginxProcessesMetricsCollector{
2221
workerProcessTotal: prometheus.NewGaugeVec(
2322
prometheus.GaugeOpts{
2423
Name: "nginx_worker_processes_total",
@@ -29,7 +28,6 @@ func NewNginxProcessesMetricsCollector(constLabels map[string]string) *NginxProc
2928
[]string{"generation"},
3029
),
3130
}
32-
return pc
3331
}
3432

3533
// updateWorkerProcessCount sets the number of NGINX worker processes

internal/metrics/collectors/workqueue.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import (
77

88
const workqueueSubsystem = "workqueue"
99

10-
// WorkQueueMetricsCollector implements prometheus.Collector interface
10+
// WorkQueueMetricsCollector collects the metrics about the work queue, which the Ingress Controller uses to process changes to the resources in the cluster.
11+
// implements the prometheus.Collector interface
1112
type WorkQueueMetricsCollector struct {
1213
depth *prometheus.GaugeVec
1314
latency *prometheus.HistogramVec
@@ -32,7 +33,7 @@ func NewWorkQueueMetricsCollector(constLabels map[string]string) *WorkQueueMetri
3233
Namespace: metricsNamespace,
3334
Subsystem: workqueueSubsystem,
3435
Name: "queue_duration_seconds",
35-
Help: "How long in seconds an item stays in workqueue before being requested",
36+
Help: "How long in seconds an item stays in workqueue before being processed",
3637
Buckets: prometheus.ExponentialBuckets(10e-9, 10, 10),
3738
ConstLabels: constLabels,
3839
},
@@ -59,7 +60,7 @@ func (wqc *WorkQueueMetricsCollector) Collect(ch chan<- prometheus.Metric) {
5960
wqc.workDuration.Collect(ch)
6061
}
6162

62-
// Describe implements prometheus.Collector interface Describe method
63+
// Describe implements the prometheus.Collector interface Describe method
6364
func (wqc *WorkQueueMetricsCollector) Describe(ch chan<- *prometheus.Desc) {
6465
wqc.depth.Describe(ch)
6566
wqc.latency.Describe(ch)

0 commit comments

Comments
 (0)