Skip to content

Commit

Permalink
Add more docs on how you can configure Prometheus scraping (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Jan 19, 2022
1 parent 573e720 commit a8cc409
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/prometheus-federation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

This example showcases how the agent works with Splunk Enterprise and an existing Prometheus deployment.

The deployment creates a [golang program](./prom-counter) that exposes a metrics endpoint, with a specific metric named `counter`.

The [golang program](./prom-counter) is scraped by a Prometheus agent, [configured](./prometheus.yml) to collect data every 10 seconds.

The Prometheus instance exposes a [federation endpoint](https://prometheus.io/docs/prometheus/latest/federation/).

The OpenTelemetry Collector scrapes the Prometheus endpoint every 10 seconds as well, with the [following configuration](./otel-collector-config.yml):

```yaml
prometheus_simple:
collection_interval: 10s
# the federation endpoint:
# Read more about it here: https://prometheus.io/docs/prometheus/latest/federation/
# You can query the federation with PromQL, encoded as part of the query string.
endpoint: prometheus:9090
metrics_path: /federate
params:
match[]: '{job="counter"}'
```
This configuration specifically scrapes metrics matching the query `{job="counter"}`.

The match expression is mandatory, and no metrics will be collected if it is omitted.

To pick up all metrics exposed by Prometheus, you can instead use the query `{job=~".+"}`.

## Run the example

The example runs as a Docker Compose deployment. The collector can be configured to send various metrics to Splunk Enterprise.

Splunk is configured to receive data from the OpenTelemetry Collector using the HTTP Event collector. To learn more about HEC, visit [our guide](https://dev.splunk.com/enterprise/docs/dataapps/httpeventcollector/).
Expand Down

0 comments on commit a8cc409

Please sign in to comment.