Skip to content

Commit

Permalink
Add docs page for http config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Jan 14, 2021
1 parent 13413a3 commit cbe7a36
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
8 changes: 7 additions & 1 deletion website/docs/components/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ These are the main components within Benthos and they provide the majority of us

## Observability Components

There are also the observability components [logger][logger], [metrics][metrics], and [tracing][tracers], which allow you to specify how Benthos exposes observability data:
There are also the observability components [http][http], [logger][logger], [metrics][metrics], and [tracing][tracers], which allow you to specify how Benthos exposes observability data:

```yaml
http:
address: 0.0.0.0:4195
enabled: true
debug_endpoints: false

logger:
prefix: benthos
level: WARN
Expand Down Expand Up @@ -115,5 +120,6 @@ For more information about any of these component types check out their sections
[metrics]: /docs/components/metrics/about
[tracers]: /docs/components/tracers/about
[logger]: /docs/components/logger/about
[http]: /docs/components/http/about
[caches]: /docs/components/caches/about
[rate_limits]: /docs/components/rate_limits/about
49 changes: 49 additions & 0 deletions website/docs/components/http/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: HTTP
---

When Benthos runs it kicks off an HTTP server that provides a few generally useful endpoints and is also where configured components such as the [`http_server` input][inputs.http_server] [and output][outputs.http_server] can register their own endpoints if they don't require their own host/port.

The configuration for this server lives under the `http` namespace, with the following default values:

```yaml
http:
address: 0.0.0.0:4195
enabled: true
read_timeout: 5s
root_path: /benthos
debug_endpoints: false
```

The field `enabled` can be set to `false` in order to disable the server.

The field `root_path` specifies a general prefix for all endpoints, this can help isolate the service endpoints when using a reverse proxy with other shared services. All endpoints will still be registered at the root as well as behind the prefix, e.g. with a `root_path` set to `/foo` the endpoint `/version` will be accessible from both `/version` and `/foo/version`.

## Endpoints

The following endpoints will be generally available when the HTTP server is enabled:

- `/version` provides version info.
- `/ping` can be used as a liveness probe as it always returns a 200.
- `/ready` can be used as a readiness probe as it serves a 200 only when both the input and output are connected, otherwise a 503 is returned.
- `/metrics`, `/stats` both provide metrics when the metrics type is either [`http_server`][metrics.http_server] or [`prometheus`][metrics.prometheus].
- `/endpoints` provides a JSON object containing a list of available endpoints, including those registered by configured components.

## Debug Endpoints

The field `debug_endpoints` when set to `true` prompts Benthos to register a few extra endpoints that can be useful for debugging performance or behavioral problems:

- `/debug/config/json` returns the loaded config as JSON.
- `/debug/config/yaml` returns the loaded config as YAML.
- `/debug/pprof/block` responds with a pprof-formatted block profile.
- `/debug/pprof/heap` responds with a pprof-formatted heap profile.
- `/debug/pprof/mutex` responds with a pprof-formatted mutex profile.
- `/debug/pprof/profile` responds with a pprof-formatted cpu profile.
- `/debug/pprof/symbol` looks up the program counters listed in the request, responding with a table mapping program counters to function names.
- `/debug/pprof/trace` responds with the execution trace in binary form. Tracing lasts for duration specified in seconds GET parameter, or for 1 second if not specified.
- `/debug/stack` returns a snapshot of the current service stack trace.

[inputs.http_server]: /docs/components/inputs/http_server
[outputs.http_server]: /docs/components/outputs/http_server
[metrics.http_server]: /docs/components/metrics/http_server
[metrics.prometheus]: /docs/components/metrics/prometheus
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
label: 'Components',
items: [
'components/about',
'components/http/about',
{
type: 'category',
label: 'Inputs',
Expand Down

0 comments on commit cbe7a36

Please sign in to comment.