1
0
mirror of https://github.com/nginxinc/nginx-prometheus-exporter.git synced 2025-07-31 21:04:21 +03:00

Add Codecov (#633)

This commit is contained in:
Luca Comellini
2024-02-21 09:16:51 -08:00
committed by GitHub
parent 9aaa38b12b
commit 49d6cff814
5 changed files with 216 additions and 201 deletions

7
.codecov.yml Normal file
View File

@ -0,0 +1,7 @@
coverage:
status:
project:
default:
informational: true
comment:
require_changes: true

View File

@ -36,6 +36,11 @@ jobs:
- name: Run Tests
run: make test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 #4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
build-docker:
name: Build Docker Image
runs-on: ubuntu-22.04

2
.gitignore vendored
View File

@ -11,3 +11,5 @@ dist/
completions/
manpages/
coverage.txt

View File

@ -23,7 +23,7 @@ lint: ## Run linter
.PHONY: test
test: ## Run tests
go test ./... -race -shuffle=on
go test ./... -race -shuffle=on -coverprofile=coverage.txt -covermode=atomic
.PHONY: container
container: ## Build container image

View File

@ -3,6 +3,7 @@
[![CI](https://github.com/nginxinc/nginx-prometheus-exporter/actions/workflows/ci.yml/badge.svg)](https://github.com/nginxinc/nginx-prometheus-exporter/actions/workflows/ci.yml)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter.svg?type=shield)](https://app.fossa.com/projects/custom%2B5618%2Fgithub.com%2Fnginxinc%2Fnginx-prometheus-exporter?ref=badge_shield)
[![Go Report Card](https://goreportcard.com/badge/github.com/nginxinc/nginx-prometheus-exporter)](https://goreportcard.com/report/github.com/nginxinc/nginx-prometheus-exporter)
[![codecov](https://codecov.io/gh/nginxinc/nginx-prometheus-exporter/graph/badge.svg?token=J6Oz10LWy3)](https://codecov.io/gh/nginxinc/nginx-prometheus-exporter)
![GitHub all releases](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/total?logo=github)
![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/nginxinc/nginx-prometheus-exporter/latest/total?sort=semver&logo=github)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/nginxinc/nginx-prometheus-exporter?logo=github&sort=semver)](https://github.com/nginxinc/nginx-prometheus-exporter/releases/latest)
@ -138,7 +139,7 @@ Flags:
### Common metrics
| Name | Type | Description | Labels |
|----|----|----|----|
| -------------------------------------------- | -------- | -------------------------------------------- | ------------------------------------------------------------------------- |
| `nginx_exporter_build_info` | Gauge | Shows the exporter build information. | `branch`, `goarch`, `goos`, `goversion`, `revision`, `tags` and `version` |
| `promhttp_metric_handler_requests_total` | Counter | Total number of scrapes by HTTP status code. | `code` (the HTTP status code) |
| `promhttp_metric_handler_requests_in_flight` | Gauge | Current number of scrapes being served. | [] |
@ -147,13 +148,13 @@ Flags:
### Metrics for NGINX OSS
| Name | Type | Description | Labels |
|----|----|----|----|
| ---------- | ----- | ------------------------------------------------------------------------------------------------ | ------ |
| `nginx_up` | Gauge | Shows the status of the last metric scrape: `1` for a successful scrape and `0` for a failed one | [] |
#### [Stub status metrics](https://nginx.org/en/docs/http/ngx_http_stub_status_module.html)
| Name | Type | Description | Labels |
|----|----|----|----|
| ---------------------------- | ------- | ------------------------------------------------------------------- | ------ |
| `nginx_connections_accepted` | Counter | Accepted client connections. | [] |
| `nginx_connections_active` | Gauge | Active client connections. | [] |
| `nginx_connections_handled` | Counter | Handled client connections. | [] |
@ -165,13 +166,13 @@ Flags:
### Metrics for NGINX Plus
| Name | Type | Description | Labels |
|----|----|----|----|
| -------------- | ----- | ------------------------------------------------------------------------------------------------ | ------ |
| `nginxplus_up` | Gauge | Shows the status of the last metric scrape: `1` for a successful scrape and `0` for a failed one | [] |
#### [Connections](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_connections)
| Name | Type | Description | Labels |
|----|----|----|----|
| -------------------------------- | ------- | ---------------------------------- | ------ |
| `nginxplus_connections_accepted` | Counter | Accepted client connections | [] |
| `nginxplus_connections_active` | Gauge | Active client connections | [] |
| `nginxplus_connections_dropped` | Counter | Dropped client connections dropped | [] |
@ -180,14 +181,14 @@ Flags:
#### [HTTP](https://nginx.org/en/docs/http/ngx_http_api_module.html#http_)
| Name | Type | Description | Labels |
|----|----|----|----|
| --------------------------------- | ------- | --------------------- | ------ |
| `nginxplus_http_requests_total` | Counter | Total http requests | [] |
| `nginxplus_http_requests_current` | Gauge | Current http requests | [] |
#### [SSL](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_ssl_object)
| Name | Type | Description | Labels |
|----|----|----|----|
| --------------------------------- | ------- | ----------------------------------- | ------ |
| `nginxplus_ssl_handshakes` | Counter | Successful SSL handshakes | [] |
| `nginxplus_ssl_handshakes_failed` | Counter | Failed SSL handshakes | [] |
| `nginxplus_ssl_session_reuses` | Counter | Session reuses during SSL handshake | [] |
@ -195,7 +196,7 @@ Flags:
#### [HTTP Server Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_server_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| ---------------------------------------- | ------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `nginxplus_server_zone_processing` | Gauge | Client requests that are currently being processed | `server_zone` |
| `nginxplus_server_zone_requests` | Counter | Total client requests | `server_zone` |
| `nginxplus_server_zone_responses` | Counter | Total responses sent to clients | `code` (the response status code. The values are: `1xx`, `2xx`, `3xx`, `4xx` and `5xx`), `server_zone` |
@ -210,7 +211,7 @@ Flags:
#### [Stream Server Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_stream_server_zone)
| Name | Type | Description | Labels |
| ----|----|----|----|
| ----------------------------------------------- | ------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `nginxplus_stream_server_zone_processing` | Gauge | Client connections that are currently being processed | `server_zone` |
| `nginxplus_stream_server_zone_connections` | Counter | Total connections | `server_zone` |
| `nginxplus_stream_server_zone_sessions` | Counter | Total sessions completed | `code` (the response status code. The values are: `2xx`, `4xx`, and `5xx`), `server_zone` |
@ -227,7 +228,7 @@ Flags:
> `"draining"` -> `2.0`, `"down"` -> `3.0`, `"unavail"` > `4.0`, `"checking"` > `5.0`, `"unhealthy"` -> `6.0`.
| Name | Type | Description | Labels |
| ----|----|----|----|
| --------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nginxplus_upstream_server_state` | Gauge | Current state | `server`, `upstream` |
| `nginxplus_upstream_server_active` | Gauge | Active connections | `server`, `upstream` |
| `nginxplus_upstream_server_limit` | Gauge | Limit for connections which corresponds to the max_conns parameter of the upstream server. Zero value means there is no limit | `server`, `upstream` |
@ -255,7 +256,7 @@ Flags:
> `"down"` -> `3.0`, `"unavail"` > `4.0`, `"checking"` > `5.0`, `"unhealthy"` -> `6.0`.
| Name | Type | Description | Labels |
|----|----|----|----|
| ---------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
| `nginxplus_stream_upstream_server_state` | Gauge | Current state | `server`, `upstream` |
| `nginxplus_stream_upstream_server_active` | Gauge | Active connections | `server` , `upstream` |
| `nginxplus_stream_upstream_server_limit` | Gauge | Limit for connections which corresponds to the max_conns parameter of the upstream server. Zero value means there is no limit | `server` , `upstream` |
@ -278,7 +279,7 @@ Flags:
#### [Stream Zone Sync](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_stream_zone_sync)
| Name | Type | Description | Labels |
|----|----|----|----|
| ------------------------------------------------- | ------- | ------------------------------------------------------------ | ------ |
| `nginxplus_stream_zone_sync_zone_records_pending` | Gauge | The number of records that need to be sent to the cluster | `zone` |
| `nginxplus_stream_zone_sync_zone_records_total` | Gauge | The total number of records stored in the shared memory zone | `zone` |
| `nginxplus_stream_zone_sync_zone_bytes_in` | Counter | Bytes received by this node | [] |
@ -290,7 +291,7 @@ Flags:
#### [Location Zones](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_location_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| ----------------------------------------- | ------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `nginxplus_location_zone_requests` | Counter | Total client requests | `location_zone` |
| `nginxplus_location_zone_responses` | Counter | Total responses sent to clients | `code` (the response status code. The values are: `1xx`, `2xx`, `3xx`, `4xx` and `5xx`), `location_zone` |
| `nginxplus_location_zone_responses_codes` | Counter | Total responses sent to clients by code | `code` (the response status code. The possible values are [here](https://www.nginx.com/resources/wiki/extending/api/http/)), `location_zone` |
@ -301,7 +302,7 @@ Flags:
#### [Resolver](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_resolver_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| ----------------------------- | ------- | ---------------------------------------------- | ---------- |
| `nginxplus_resolver_name` | Counter | Total requests to resolve names to addresses | `resolver` |
| `nginxplus_resolver_srv` | Counter | Total requests to resolve SRV records | `resolver` |
| `nginxplus_resolver_addr` | Counter | Total requests to resolve addresses to names | `resolver` |
@ -317,7 +318,7 @@ Flags:
#### [HTTP Requests Rate Limiting](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_limit_req_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| ------------------------------------------ | ------- | --------------------------------------------------------------------------- | ------ |
| `nginxplus_limit_request_passed` | Counter | Total number of requests that were neither limited nor accounted as limited | `zone` |
| `nginxplus_limit_request_rejected` | Counter | Total number of requests that were rejected | `zone` |
| `nginxplus_limit_request_delayed` | Counter | Total number of requests that were delayed | `zone` |
@ -327,7 +328,7 @@ Flags:
#### [HTTP Connections Limiting](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_http_limit_conn_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| --------------------------------------------- | ------- | ------------------------------------------------------------------------------ | ------ |
| `nginxplus_limit_connection_passed` | Counter | Total number of connections that were neither limited nor accounted as limited | `zone` |
| `nginxplus_limit_connection_rejected` | Counter | Total number of connections that were rejected | `zone` |
| `nginxplus_limit_connection_rejected_dry_run` | Counter | Total number of connections accounted as rejected in the dry run mode | `zone` |
@ -335,7 +336,7 @@ Flags:
#### [Stream Connections Limiting](https://nginx.org/en/docs/http/ngx_http_api_module.html#def_nginx_stream_limit_conn_zone)
| Name | Type | Description | Labels |
|----|----|----|----|
| ---------------------------------------------------- | ------- | ------------------------------------------------------------------------------ | ------ |
| `nginxplus_stream_limit_connection_passed` | Counter | Total number of connections that were neither limited nor accounted as limited | `zone` |
| `nginxplus_stream_limit_connection_rejected` | Counter | Total number of connections that were rejected | `zone` |
| `nginxplus_stream_limit_connection_rejected_dry_run` | Counter | Total number of connections accounted as rejected in the dry run mode | `zone` |
@ -343,7 +344,7 @@ Flags:
#### [Cache](https://nginx.org/en/docs/http/ngx_http_api_module.html#http_caches_http_cache_zone_name)
| Name | Type | Description | Labels |
|----|----|----|----|
| ------------------------------------------- | ------- | ----------------------------------------------------------------------- | ------- |
| `nginxplus_cache_size` | Gauge | Total size of the cache | `cache` |
| `nginxplus_cache_max_size` | Gauge | Maximum size of the cache | `cache` |
| `nginxplus_cache_cold` | Gauge | Is the cache considered cold | `cache` |
@ -369,7 +370,7 @@ Flags:
#### [Worker](hhttps://nginx.org/en/docs/http/ngx_http_api_module.html#workers)
| Name | Type | Description | Labels |
|----|-------|----|------------|
| ---------------------------------------- | ------- | ---------------------------------------------------------------------------------------------- | ----------- |
| `nginxplus_worker_connection_accepted` | Counter | The total number of accepted client connections | `id`, `pid` |
| `nginxplus_worker_connection_dropped` | Counter | The total number of accepted client connections | `id`, `pid` |
| `nginxplus_worker_connection_active` | Gauge | The current number of active client connections | `id`, `pid` |
@ -396,7 +397,7 @@ We publish the Docker image on [DockerHub](https://hub.docker.com/r/nginx/nginx-
[Amazon ECR Public Gallery](https://gallery.ecr.aws/nginx/nginx-prometheus-exporter) and
[Quay.io](https://quay.io/repository/nginx/nginx-prometheus-exporter).
As an alternative, you can choose the *edge* version built from the [latest commit](https://github.com/nginxinc/nginx-prometheus-exporter/commits/main)
As an alternative, you can choose the _edge_ version built from the [latest commit](https://github.com/nginxinc/nginx-prometheus-exporter/commits/main)
from the main branch. The edge version is useful for experimenting with new features that are not yet published in a
stable release.