Skip to content

Commit

Permalink
docs: expand remote.http documentation to demonstrate target label op…
Browse files Browse the repository at this point in the history
…tions (#5233)
  • Loading branch information
proffalken authored Sep 20, 2023
1 parent d4ec620 commit 397de72
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Main (unreleased)
have been standardized. The first fields will always be `ts`, `level`, and
`msg`, followed by non-common fields. Previously, the position of `msg` was
not consistent. (@rfratto)
- Documentation updated to link discovery.http and prometheus.scrape advanced configs (@proffalken)

### Bugfixes

Expand Down
47 changes: 47 additions & 0 deletions docs/sources/flow/reference/components/discovery.http.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,53 @@ Example response body:
]
```

It is possible to use additional fields in the JSON to pass parameters to [prometheus.scrape](../prometheus.scrape#technical-details) such as the `metricsPath` and `scrape_interval`.

As an example, the following will provide a target with a custom `metricsPath`, scrape interval, and timeout value:

```json
[
{
"labels" : {
"__metrics_path__" : "/api/prometheus",
"__scheme__" : "https",
"__scrape_interval__" : "60s",
"__scrape_timeout__" : "10s",
"service" : "custom-api-service"
},
"targets" : [
"custom-api:443"
]
},
]

```

It is also possible to append query parameters to the metrics path with the `__param_<name>` syntax.

For example, the following will call a metrics path of `/health?target_data=prometheus`:

```json
[
{
"labels" : {
"__metrics_path__" : "/health",
"__scheme__" : "https",
"__scrape_interval__" : "60s",
"__scrape_timeout__" : "10s",
"__param_target_data": "prometheus",
"service" : "custom-api-service"
},
"targets" : [
"custom-api:443"
]
},
]

```

For more information on the potential labels you can use, see the [prometheus.scrape technical details](../prometheus.scrape#technical-details) section, or the [Prometheus Configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) documentation.

## Usage

```river
Expand Down

0 comments on commit 397de72

Please sign in to comment.