Skip to content

Remove prometheus exec #3512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

- (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))
- Specify the `install_fluentd: True` attribute in your pillar to enable installation
- Removed `prometheus_exec` receiver, matching upstream. Please see [migration guide](docs/deprecations/migrating-from-prometheus-exec-to-prometheus.md) for further details.

## v0.82.0

Expand Down
1 change: 0 additions & 1 deletion docs/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ The distribution offers support for the following components.
| [oracledb](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/oracledbreceiver) | [alpha] |
| [otlp](https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver) | [stable] |
| [postgres](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/postgresqlreceiver) | [beta] |
| [prometheusexecreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusexecreceiver) | [deprecated] |
| [prometheusreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver) | [beta] |
| [receiver_creator](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/receivercreator) | [beta] |
| [redis](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/redisreceiver) | [beta] |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Removal of deprecated prometheusexec receiever
## Why is this happening?
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.

## If I'm using the prometheusexec receiver, what should I do?

We recommend you migrate your configuration to use the [prometheus](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver) opentelemetry receiver.

### Natively your metrics for scraping
The exact method of your migration will depend on why you needed to use the `prometheus_exec` scraper in the first place.


#### Prometheus exporters
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).

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.

#### Non-standard usage
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.

For more novel use cases such as running arbitrary code, this is no longer supported.

### Moving configuration to the prometheus receiver

You may reuse the `scrape_interval` and `port` when migrating to the `prometheus` opentelemetry receiver.
Assuming your endpoint is on `localhost:8080`, your config may look something like this

```yaml
receivers:
prometheus:
config:
scrape_configs:
- job_name: 'scrape-prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8080']
```

For further configuration options, please see the [documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver#readme).
16 changes: 16 additions & 0 deletions examples/prometheusexec-migration/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NODE_EXPORTER_VERSION=1.6.1
ARCH=amd64
OS=linux
OTEL_VERSION=0.82.0

run-sample-exec:
wget --no-clobber https://github.com/signalfx/splunk-otel-collector/releases/download/v$(OTEL_VERSION)/otelcol_$(OS)_$(ARCH)
wget --no-clobber https://github.com/prometheus/node_exporter/releases/download/v$(NODE_EXPORTER_VERSION)/node_exporter-$(NODE_EXPORTER_VERSION).$(OS)-$(ARCH).tar.gz
tar -xzvf node_exporter-$(NODE_EXPORTER_VERSION).$(OS)-$(ARCH).tar.gz
mv node_exporter-$(NODE_EXPORTER_VERSION).$(OS)-$(ARCH)/node_exporter ./
chmod +x ./otelcol_$(OS)_$(ARCH)
./otelcol_$(OS)_$(ARCH) --config otel-collector-config-with-exec.yaml
run-sample-noexec:
docker-compose up --build

.PHONY: run-sample-exec run-sample-noexec
10 changes: 10 additions & 0 deletions examples/prometheusexec-migration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Migration example
This example uses `node_exporter`, but the logic should be applicable for any exporter.
Wait 10 seconds after application startup to begin seeing the actual results of the node_exporter scraping.

### Using the removed prometheus_exec receiver
Run `make run-sample-exec` for a "pre-migration" example.

### Using the promtheus scraping receiver
Run `make run-sample-noexec`

24 changes: 24 additions & 0 deletions examples/prometheusexec-migration/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.8"
services:
otelcollector:
image: quay.io/signalfx/splunk-otel-collector:0.82.0
container_name: otelcollector-prometheus-exec
command: ["--config=/etc/otel-collector-config.yaml", "--set=service.telemetry.logs.level=debug"]
volumes:
- ./otel-collector-config-without-exec.yaml:/etc/otel-collector-config.yaml
ports:
- "19291:19291"
- "8888:8888"
depends_on:
node_exporter:
condition: service_started
node_exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter-prometheus-exec
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
receivers:
prometheus_exec:
exec: ./node_exporter
port: 9100
scrape_interval: 10s
processors:
batch:
exporters:
logging:
verbosity: Detailed
service:
pipelines:
metrics:
receivers: ["prometheus_exec"]
processors: ["batch"]
exporters:
- "logging"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
receivers:
prometheus:
config:
scrape_configs:
- job_name: 'scrape-node-exporter'
scrape_interval: 5s
static_configs:
- targets: ['0.0.0.0:9100']
processors:
batch:
exporters:
logging:
verbosity: Detailed
service:
pipelines:
metrics:
receivers: ["prometheus"]
processors: ["batch"]
exporters:
- "logging"
2 changes: 0 additions & 2 deletions internal/components/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/oracledbreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusexecreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/receivercreator"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redisreceiver"
Expand Down Expand Up @@ -155,7 +154,6 @@ func Get() (otelcol.Factories, error) {
oracledbreceiver.NewFactory(),
otlpreceiver.NewFactory(),
postgresqlreceiver.NewFactory(),
prometheusexecreceiver.NewFactory(),
prometheusreceiver.NewFactory(),
receivercreator.NewFactory(),
redisreceiver.NewFactory(),
Expand Down
1 change: 0 additions & 1 deletion internal/components/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func TestDefaultComponents(t *testing.T) {
"otlp",
"postgresql",
"prometheus",
"prometheus_exec",
"prometheus_simple",
"receiver_creator",
"redis",
Expand Down