-
Notifications
You must be signed in to change notification settings - Fork 170
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
Remove prometheus exec #3512
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
50ccf6d
remove from components
hughesjj 95ad28d
add prometheusexec removal guidance
hughesjj 3605607
review feedback
hughesjj f16d265
nits of spelling/grammar/language
hughesjj a2237f7
Update docs/deprecations/migrating-from-prometheus-exec-to-prometheus.md
hughesjj d6ffc59
add an example
hughesjj 2d0d869
polish
hughesjj 6eabac4
better way of running
hughesjj 9e11dde
whoops, make names consistent
hughesjj 3a7d6f1
remove no longer used code
hughesjj f63714f
remove unused config option from exec config
hughesjj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
docs/deprecations/migrating-from-prometheus-exec-to-prometheus.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
hughesjj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
17 changes: 17 additions & 0 deletions
17
examples/prometheusexec-migration/otel-collector-config-with-exec.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
20 changes: 20 additions & 0 deletions
20
examples/prometheusexec-migration/otel-collector-config-without-exec.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.