Skip to content

Commit 0739725

Browse files
hughesjjjinja2
andauthored
Remove prometheus exec (#3512)
* remove from components * add prometheusexec removal guidance and an example Co-authored-by: Jina Jain <[email protected]> * add an example * polish * better way of running * whoops, make names consistent * remove no longer used code * remove unused config option from exec config --------- Co-authored-by: Jina Jain <[email protected]>
1 parent eb7add8 commit 0739725

File tree

11 files changed

+121
-4
lines changed

11 files changed

+121
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
- (Splunk) Fluentd installation ***disabled*** by default for the [`splunk-otel-collector` salt formula](https://github.com/signalfx/splunk-otel-collector/tree/main/deployments/salt) ([#3448](https://github.com/signalfx/splunk-otel-collector/pull/3448))
1111
- Specify the `install_fluentd: True` attribute in your pillar to enable installation
12+
- Removed `prometheus_exec` receiver, matching upstream. Please see [migration guide](docs/deprecations/migrating-from-prometheus-exec-to-prometheus.md) for further details.
1213

1314
## v0.82.0
1415

docs/components.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ The distribution offers support for the following components.
3535
| [oracledb](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/oracledbreceiver) | [alpha] |
3636
| [otlp](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver) | [stable] |
3737
| [postgres](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/postgresqlreceiver) | [beta] |
38-
| [prometheusexecreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusexecreceiver) | [deprecated] |
3938
| [prometheusreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver) | [beta] |
4039
| [receiver_creator](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/receivercreator) | [beta] |
4140
| [redis](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver) | [beta] |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Removal of deprecated prometheusexec receiever
2+
## Why is this happening?
3+
There exist [security concerns](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6722) using the promethusexec receiver. All prometheus specific functionality should be supported in the "normal" prometheus (scraping) receiver, along with others.
4+
5+
## If I'm using the prometheusexec receiver, what should I do?
6+
7+
We recommend you migrate your configuration to use the [prometheus](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver) opentelemetry receiver.
8+
9+
### Natively your metrics for scraping
10+
The exact method of your migration will depend on why you needed to use the `prometheus_exec` scraper in the first place.
11+
12+
13+
#### Prometheus exporters
14+
The intended use case for the `prometheus_exec` receiver was to leverage the rich existing community of prometheus exporters (not to be confused with the opentelemetry-collector-contrib `prometheusexporter`). If this was your use case, we first reccomend checking to see if there is a native open-telemetry collector receiver in [core](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver), [contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver), or our [splunk distribution](https://github.com/signalfx/splunk-otel-collector/tree/main/internal/receiver).
15+
16+
If no equivalent reciever exists for a given prometheus exporter, or if you simply wish to continue using prometheus exporters, you will need to manually run the relevant prometheus exporter ([list](https://prometheus.io/docs/instrumenting/exporters/)) on your own infrastructure. While the details of how you decide to deploy and manage your infrastructure is beyond the scope of this migration, we have provided an [example configuration](../../examples/prometheusexec-migration/README.md) using the [node exporter](https://github.com/prometheus/node_exporter#readme) in `examples/prometheusexec-migration` in this git repo.
17+
18+
#### Non-standard usage
19+
If you needed to federate between a prometheus server and otel, you can [enable federation](https://prometheus.io/docs/prometheus/latest/federation/) on your prometheus server, you can see our [prometheus-federation](./examples/prometheus-federation/README.md) example under [`examples/prometheus-federation`](./examples/prometheus-federation) in this git repository. Ensure your endpoint is accessible from your otel collector, and feel free to ask in the [#otel-prometheus-wg](https://cloud-native.slack.com/archives/C01LSCJBXDZ), [#otel-collector](https://cloud-native.slack.com/archives/C01N6P7KR6W), or [#prometheus](https://cloud-native.slack.com/archives/C167KFM6C) slack channels for any help. You can also feel free to cut us an issue, or reach out to your support representative.
20+
21+
For more novel use cases such as running arbitrary code, this is no longer supported.
22+
23+
### Moving configuration to the prometheus receiver
24+
25+
You may reuse the `scrape_interval` and `port` when migrating to the `prometheus` opentelemetry receiver.
26+
Assuming your endpoint is on `localhost:8080`, your config may look something like this
27+
28+
```yaml
29+
receivers:
30+
prometheus:
31+
config:
32+
scrape_configs:
33+
- job_name: 'scrape-prometheus'
34+
scrape_interval: 5s
35+
static_configs:
36+
- targets: ['localhost:8080']
37+
```
38+
39+
For further configuration options, please see the [documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver#readme).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM quay.io/signalfx/splunk-otel-collector:0.82.0
2+
COPY --from=quay.io/prometheus/node-exporter:v1.6.1 --chown=999 /bin/node_exporter /usr/bin/node_exporter
3+
CMD ["otelcol"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
run-sample-exec:
2+
docker build -t prometheus-exec-example . && \
3+
docker run -v ./otel-collector-config-with-exec.yaml:/etc/otel-collector-config.yaml prometheus-exec-example --config /etc/otel-collector-config.yaml --set=service.telemetry.logs.level=debug
4+
run-sample-noexec:
5+
docker-compose up --build
6+
7+
.PHONY: run-sample-exec run-sample-noexec
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Migration example
2+
This example uses `node_exporter`, but the logic should be applicable for any exporter.
3+
Wait 10 seconds after application startup to begin seeing the actual results of the node_exporter scraping.
4+
5+
### Using the removed prometheus_exec receiver
6+
Run `make run-sample-exec` for a "pre-migration" example.
7+
8+
### Using the promtheus scraping receiver
9+
Run `make run-sample-noexec`
10+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: "3.8"
2+
services:
3+
otelcollector:
4+
image: quay.io/signalfx/splunk-otel-collector:0.82.0
5+
container_name: otelcollector-prometheus-exec
6+
command: ["--config=/etc/otel-collector-config.yaml", "--set=service.telemetry.logs.level=debug"]
7+
volumes:
8+
- ./otel-collector-config-without-exec.yaml:/etc/otel-collector-config.yaml
9+
ports:
10+
- "19291:19291"
11+
- "8888:8888"
12+
depends_on:
13+
node_exporter:
14+
condition: service_started
15+
node_exporter:
16+
image: quay.io/prometheus/node-exporter:v1.6.1
17+
container_name: node_exporter-prometheus-exec
18+
command:
19+
- '--path.rootfs=/host'
20+
network_mode: host
21+
pid: host
22+
restart: unless-stopped
23+
volumes:
24+
- '/:/host:ro,rslave'
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
receivers:
2+
prometheus_exec:
3+
exec: /usr/bin/node_exporter
4+
port: 9100
5+
scrape_interval: 10s
6+
processors:
7+
batch:
8+
exporters:
9+
logging:
10+
verbosity: Detailed
11+
service:
12+
pipelines:
13+
metrics:
14+
receivers: ["prometheus_exec"]
15+
processors: ["batch"]
16+
exporters:
17+
- "logging"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
receivers:
2+
prometheus:
3+
config:
4+
scrape_configs:
5+
- job_name: 'scrape-node-exporter'
6+
scrape_interval: 5s
7+
static_configs:
8+
- targets: ['0.0.0.0:9100']
9+
processors:
10+
batch:
11+
exporters:
12+
logging:
13+
verbosity: Detailed
14+
service:
15+
pipelines:
16+
metrics:
17+
receivers: ["prometheus"]
18+
processors: ["batch"]
19+
exporters:
20+
- "logging"

internal/components/components.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ import (
6666
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver"
6767
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver"
6868
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver"
69-
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusexecreceiver"
7069
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver"
7170
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator"
7271
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver"
@@ -155,7 +154,6 @@ func Get() (otelcol.Factories, error) {
155154
oracledbreceiver.NewFactory(),
156155
otlpreceiver.NewFactory(),
157156
postgresqlreceiver.NewFactory(),
158-
prometheusexecreceiver.NewFactory(),
159157
prometheusreceiver.NewFactory(),
160158
receivercreator.NewFactory(),
161159
redisreceiver.NewFactory(),

0 commit comments

Comments
 (0)