Skip to content

Commit a8cc409

Browse files
authored
Add more docs on how you can configure Prometheus scraping (signalfx#1116)
1 parent 573e720 commit a8cc409

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

examples/prometheus-federation/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

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

5+
The deployment creates a [golang program](./prom-counter) that exposes a metrics endpoint, with a specific metric named `counter`.
6+
7+
The [golang program](./prom-counter) is scraped by a Prometheus agent, [configured](./prometheus.yml) to collect data every 10 seconds.
8+
9+
The Prometheus instance exposes a [federation endpoint](https://prometheus.io/docs/prometheus/latest/federation/).
10+
11+
The OpenTelemetry Collector scrapes the Prometheus endpoint every 10 seconds as well, with the [following configuration](./otel-collector-config.yml):
12+
13+
```yaml
14+
prometheus_simple:
15+
collection_interval: 10s
16+
# the federation endpoint:
17+
# Read more about it here: https://prometheus.io/docs/prometheus/latest/federation/
18+
# You can query the federation with PromQL, encoded as part of the query string.
19+
endpoint: prometheus:9090
20+
metrics_path: /federate
21+
params:
22+
match[]: '{job="counter"}'
23+
```
24+
25+
This configuration specifically scrapes metrics matching the query `{job="counter"}`.
26+
27+
The match expression is mandatory, and no metrics will be collected if it is omitted.
28+
29+
To pick up all metrics exposed by Prometheus, you can instead use the query `{job=~".+"}`.
30+
31+
## Run the example
32+
533
The example runs as a Docker Compose deployment. The collector can be configured to send various metrics to Splunk Enterprise.
634

735
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/).

0 commit comments

Comments
 (0)