Skip to content

Commit

Permalink
Lint code. Improve docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean-Coakley committed Dec 8, 2020
1 parent 6984981 commit e3dc777
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
11 changes: 5 additions & 6 deletions docs-web/logging-and-monitoring/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ The Ingress Controller exports the following metrics:
* `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.
* `controller_virtualserver_resources_total`. Number of handled VirtualServer resources.
* `controller_virtualserverroute_resources_total`. Number of handled VirtualServerRoute resources. **Note**: The metric counts only VirtualServerRoutes that have a reference from a VirtualServer.
* Kubernetes Cluster metrics
* `controller_workqueue_depth` Current depth of workqueue.
* `controller_workqueue_queue_duration_second`. How long in seconds an item stays in workqueue before being requested.
* `controller_workqueue_work_duration_seconds`. How long in seconds processing an item from workqueue takes.
* 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"`
* `workqueue_depth`. Current depth of the workqueue.
* `workqueue_queue_duration_second`. How long in seconds an item stays in the workqueue before being requested.
* `workqueue_work_duration_seconds`. How long in seconds processing an item from the workqueue takes.


**Note**: all metrics have the namespace nginx_ingress. For example, nginx_ingress_controller_nginx_reloads_total.
**Note**: all metrics have the namespace `nginx_ingress`. For example, `nginx_ingress_controller_nginx_reloads_total`.

**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.
6 changes: 2 additions & 4 deletions internal/metrics/collectors/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

// NginxProcessesMetricsCollector implements NginxProcessesCollector interface and prometheus.Collector interface
// NginxProcessesMetricsCollector implements prometheus.Collector interface
type NginxProcessesMetricsCollector struct {
// Metrics
workerProcessTotal *prometheus.GaugeVec
}

// NewNginxProcessesMetricsCollector creates a new NginxProcessMetricsCollector
func NewNginxProcessesMetricsCollector(constLabels map[string]string) *NginxProcessesMetricsCollector {
pc := &NginxProcessesMetricsCollector{
return &NginxProcessesMetricsCollector{
workerProcessTotal: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "nginx_worker_processes_total",
Expand All @@ -29,7 +28,6 @@ func NewNginxProcessesMetricsCollector(constLabels map[string]string) *NginxProc
[]string{"generation"},
),
}
return pc
}

// updateWorkerProcessCount sets the number of NGINX worker processes
Expand Down
7 changes: 4 additions & 3 deletions internal/metrics/collectors/workqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (

const workqueueSubsystem = "workqueue"

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

// Describe implements prometheus.Collector interface Describe method
// Describe implements the prometheus.Collector interface Describe method
func (wqc *WorkQueueMetricsCollector) Describe(ch chan<- *prometheus.Desc) {
wqc.depth.Describe(ch)
wqc.latency.Describe(ch)
Expand Down

0 comments on commit e3dc777

Please sign in to comment.