You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: examples/prometheus-federation/README.md
+28
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,34 @@
2
2
3
3
This example showcases how the agent works with Splunk Enterprise and an existing Prometheus deployment.
4
4
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
+
5
33
The example runs as a Docker Compose deployment. The collector can be configured to send various metrics to Splunk Enterprise.
6
34
7
35
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