Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add beta metrics documentation #351

Merged
merged 4 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
3 changes: 3 additions & 0 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
30 changes: 30 additions & 0 deletions docs/METRICS.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 4 additions & 1 deletion docs/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file added docs/img/grafana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.