Commit 5ba61d6
authored
6473 – Update collector configuration to allow multiple services (#110)
Updates the collector configuration to deal with receiving and exporting metrics from multiple services.
### Important
**When thinking about adding multiple receivers/exporters, we need to take into consideration:**
- unlike most otel-collector's receivers and exporters, we can't add multiple prometheus receivers by aliasing, e.g.: `prometheus/service_1`, `prometheus/service_2`. We can have only one receiver, which can have multiple jobs.
- unlike when sending traces, we need to specify the dataset when exporting metrics to honeycomb via the otlp exporter.
**The way we dealt with this is by using the routing connector:**
- we have a pipeline with the prometheus receiver, and the connector functioning as the exporter
- we have a second pipeline with the connector functioning as the receiver, and otlp set up as the exporter
- inside the connector we have a table where we use the service name to decide into which pipeline it should go
- the prometheus receiver sets the service name from the job_name
**If we want to send prometheus metrics from another service, we would need to:**
- add the endpoint variable to the otel-collector configuration in the docker-compose file (local development)
- add a new job to prometheus' scrape_config,
- add another item to the routing connector table
- add another exporter `otlp/service_metrics`, with the correct Dataset (considering we are also sending metrics to Honeycomb)
- add another pipeline `metrics/service` with the new exporter
**Notes**
- This does add some duplication, but seems the most straightforward way to deal with this, at least for now
- There is a tool to dynamically allocate targets for the prometheus receiver, but it is specific to kubernetes, so not useful for us right now
- Regarding the connector and debugging: the default_pipelines is where anything that is not matched is sent. We currently only use it when debugging. To debug the connector, you can also use the debug pipeline (commented out), and use the debug exporter.
**References**
- [Routing Connector](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/connector/routingconnector)
- [Sending metrics to honeycomb](https://docs.honeycomb.io/send-data/opentelemetry/collector/#metrics-and-logs-signals)
- [Prometheus Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver)
- [Prometheus Receiver Configuration](https://github.com/prometheus/prometheus/blob/v2.28.1/docs/configuration/configuration.md#scrape_config)
- [Two Prometheus receivers can't be defined](open-telemetry/opentelemetry-operator#3034)
- [Target Allocator](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver#opentelemetry-operator)1 parent f2aa02b commit 5ba61d6
2 files changed
Lines changed: 28 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
176 | | - | |
| 177 | + | |
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
26 | 40 | | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
32 | | - | |
| 46 | + | |
33 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
34 | 51 | | |
35 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments