diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed6a74ff912..b66993651f79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - `datadogexporter`: Deprecate `service` setting in favor of `service.name` semantic convention (#8784) - `datadogexporter`: Deprecate `version` setting in favor of `service.version` semantic convention (#8784) - `datadogexporter`: Deprecate `GetHostTags` method from `TagsConfig` struct (#8975) +- `prometheusexecreceiver`: Deprecate prom_exec receiver (#9058) - `fluentbitextension`: Deprecate Fluentbit extension (#9062) ### 🚀 New components 🚀 diff --git a/receiver/prometheusexecreceiver/README.md b/receiver/prometheusexecreceiver/README.md index d87f0f250534..7c587c79c4bc 100644 --- a/receiver/prometheusexecreceiver/README.md +++ b/receiver/prometheusexecreceiver/README.md @@ -1,4 +1,7 @@ -# prometheus_exec Receiver +# Deprecated prometheus_exec Receiver + +This receiver has been deprecated due to security concerns around the ability to specify the execution of +any arbitrary processes via its configuration. See [#6722](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/6722) for additional details. This receiver makes it easy for a user to collect metrics from third-party services **via Prometheus exporters**. It's meant for people who want a diff --git a/receiver/prometheusexecreceiver/factory.go b/receiver/prometheusexecreceiver/factory.go index ce4754d9c7a2..3f2a4f340e48 100644 --- a/receiver/prometheusexecreceiver/factory.go +++ b/receiver/prometheusexecreceiver/factory.go @@ -16,11 +16,13 @@ package prometheusexecreceiver // import "github.com/open-telemetry/opentelemetr import ( "context" + "sync" "time" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" + "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusexecreceiver/subprocessmanager" ) @@ -34,6 +36,8 @@ const ( defaultTimeoutInterval = 10 * time.Second ) +var once sync.Once + // NewFactory creates a factory for the prometheusexec receiver func NewFactory() component.ReceiverFactory { return component.NewReceiverFactory( @@ -42,6 +46,12 @@ func NewFactory() component.ReceiverFactory { component.WithMetricsReceiver(createMetricsReceiver)) } +func logDeprecation(logger *zap.Logger) { + once.Do(func() { + logger.Warn("prometheus_exec receiver is deprecated and will be removed in future versions.") + }) +} + // createDefaultConfig returns a default config func createDefaultConfig() config.Receiver { return &Config{ @@ -61,6 +71,7 @@ func createMetricsReceiver( cfg config.Receiver, nextConsumer consumer.Metrics, ) (component.MetricsReceiver, error) { + logDeprecation(params.Logger) rCfg := cfg.(*Config) return newPromExecReceiver(params, rCfg, nextConsumer) }