diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf1f45ec..c76f0704c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Unreleased changes are available as `avenga/couper:edge` container. * [**Beta**](./docs/BETA.md) * `beta_scope_claim` attribute to [`jwt` block](./docs/REFERENCE.md#jwt-block); `beta_scope` attribute to [`api`](./docs/REFERENCE.md#api-block) and [`endpoint` block](./docs/REFERENCE.md#endpoint-block)s; [error types](./docs/ERRORS.md#error-types) `beta_operation_denied` and `beta_insufficient_scope` ([#315](https://github.com/avenga/couper/pull/315)) * `beta_roles_claim` and `beta_roles_map` attributes to [`jwt` block](./docs/REFERENCE.md#jwt-block) ([#325](https://github.com/avenga/couper/pull/325)) ([#338](https://github.com/avenga/couper/pull/338)) ([#352](https://github.com/avenga/couper/pull/352)) + * Metrics: [Prometheus exporter](./docs/METRICS.md) ([#295](https://github.com/avenga/couper/pull/295)) * **Dependencies** * build with go 1.17 ([#331](https://github.com/avenga/couper/pull/331)) diff --git a/DOCKER.md b/DOCKER.md index 72f6c287c..9e4c722da 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -44,6 +44,10 @@ docker run avenga/couper run -watch -p 8081 | COUPER_WATCH_RETRY_DELAY | `500ms` | Delay duration before next attempt if an error occurs. | | COUPER_XFH | `false` | Global configurations which uses the `Forwarded-Host` header instead of the request host. | | | | | +| COUPER_BETA_METRICS | `false` | Option to enable the prometheus [metrics](https://github.com/avenga/couper/blob/master/docs/METRICS.md) exporter. | +| COUPER_BETA_METRICS_PORT | `9090` | Prometheus exporter listen port. | +| COUPER_BETA_SERVICE_NAME | `couper` | The service name which applies to the `service_name` metric labels. | +| | | | | COUPER_REQUEST_ID_ACCEPT_FROM_HEADER | `""` | Name of a client request HTTP header field that transports the `request.id` which Couper takes for logging and transport to the backend (if configured). | | COUPER_REQUEST_ID_BACKEND_HEADER | `Couper-Request-ID` | Name of a HTTP header field which Couper uses to transport the `request.id` to the backend. | | COUPER_REQUEST_ID_CLIENT_HEADER | `Couper-Request-ID` | Name of a HTTP header field which Couper uses to transport the `request.id` to the client. | diff --git a/docs/CLI.md b/docs/CLI.md index 355c93826..6e3c7d390 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -33,3 +33,6 @@ _Note_: `log-format`, `log-level` and `log-pretty` also map to [settings](REFERE | :---------------------- | :----------- | :---------------------------- | :----------- | | `-accept-forwarded-url` | empty string | `COUPER_ACCEPT_FORWARDED_URL` | Which `X-Forwarded-*` request headers should be accepted to change the [request variables](./REFERENCE.md#request) `url`, `origin`, `protocol`, `host`, `port`. Comma-separated list of values. Valid values: `proto`, `host`, `port` | | `-https-dev-proxy` | empty string | `COUPER_HTTPS_DEV_PROXY` | List of tls port mappings to define the tls listen port and the target one. A self-signed certificate will be generated on the fly based on given hostname. | +| `-beta-metrics` | - | `COUPER_BETA_METRICS` | Option to enable the prometheus [metrics](./METRICS.md) exporter. | +| `-beta-metrics-port` | `9090` | `COUPER_BETA_METRICS_PORT` | Prometheus exporter listen port. | +| `-beta-service-name` | `couper` | `COUPER_BETA_SERVICE_NAME` | The service name which applies to the `service_name` metric labels. | diff --git a/docs/METRICS.md b/docs/METRICS.md new file mode 100644 index 000000000..bcf61178c --- /dev/null +++ b/docs/METRICS.md @@ -0,0 +1,30 @@ +- [Metrics](#metrics) + - [Prometheus](#prometheus) + - [Grafana Dashboard](#grafana-dashboard) + - [Preview](#preview) + - [Developers](#developers) + +# Metrics + +Our metrics feature is [beta](./BETA.md) for now. However, we want to provide some core metrics which can be directly collected from Couper. + +## Prometheus + +Couper provides a built-in [Prometheus](https://prometheus.io/) exporter. It is configurable with [settings](./REFERENCE.md#settings-block) like port or `service_name` label. If enabled the default scrape target port is `9090`. + +## Grafana Dashboard + +Couper provides a maintained Grafana dashboard which you can find here: [grafana.json](./../grafana.json) +and import this JSON model to your grafana instance. +You may have to set your Datasource to your Prometheus one. + +If you're missing some configuration options or have feedback: Feel free to open a [discussion](https://github.com/avenga/couper/discussions) or +an [issue](https://github.com/avenga/couper/issues) if something does not work as expected or shown values does not make any sense. + +### Preview + +![dashboard](./img/grafana.png) + +## Developers + +If you are interested in contributing to our metrics or refine the grafana dashboard: `make docker-telemetry` will spin up the stack for you. diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index b71da74bf..b4a824b24 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -503,7 +503,10 @@ gateway instance. | `request_id_client_header` | string | `Couper-Request-ID` | Name of a HTTP header field which Couper uses to transport the `request.id` to the client. |-|-| | `request_id_format` | string | `common` | If set to `uuid4` a rfc4122 uuid is used for `request.id` and related log fields. |-|-| | `secure_cookies` | string | `""` | If set to `"strip"`, the `Secure` flag is removed from all `Set-Cookie` HTTP header fields. |-|-| -| `xfh` | bool | `false` | Option to use the `X-Forwarded-Host` header as the request host. |-|-| +| `xfh` | bool | `false` | Option to use the `X-Forwarded-Host` header as the request host. | - | - | +| `beta_metrics` | bool | `false` | Option to enable the prometheus [metrics](./METRICS.md) exporter. | - | - | +| `beta_metrics_port` | number | `9090` | Prometheus exporter listen port. | - | - | +| `beta_service_name` | string | `couper` | The service name which applies to the `service_name` metric labels. | - | - | ### Defaults Block diff --git a/docs/img/grafana.png b/docs/img/grafana.png new file mode 100644 index 000000000..958d7a2c6 Binary files /dev/null and b/docs/img/grafana.png differ