diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffad0c472b7..338b779cb146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,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) +- `jmxreceiver`: Deprecate JMX receiver () ### 🚀 New components 🚀 diff --git a/receiver/jmxreceiver/README.md b/receiver/jmxreceiver/README.md index 945830e0b6a2..b337997eb339 100644 --- a/receiver/jmxreceiver/README.md +++ b/receiver/jmxreceiver/README.md @@ -1,4 +1,4 @@ -# JMX Receiver +# Deprecated JMX Receiver ### Overview diff --git a/receiver/jmxreceiver/factory.go b/receiver/jmxreceiver/factory.go index 2a69cea8acc3..afa7a56a4679 100644 --- a/receiver/jmxreceiver/factory.go +++ b/receiver/jmxreceiver/factory.go @@ -16,12 +16,14 @@ package jmxreceiver // import "github.com/open-telemetry/opentelemetry-collector import ( "context" + "sync" "time" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/exporter/exporterhelper" + "go.uber.org/zap" ) const ( @@ -29,6 +31,8 @@ const ( otlpEndpoint = "0.0.0.0:0" ) +var once sync.Once + func NewFactory() component.ReceiverFactory { return component.NewReceiverFactory( typeStr, @@ -51,12 +55,19 @@ func createDefaultConfig() config.Receiver { } } +func logDeprecation(logger *zap.Logger) { + once.Do(func() { + logger.Warn("jmx receiver is deprecated and will be removed in future versions.") + }) +} + func createReceiver( _ context.Context, params component.ReceiverCreateSettings, cfg config.Receiver, consumer consumer.Metrics, ) (component.MetricsReceiver, error) { + logDeprecation(params.Logger) jmxConfig := cfg.(*Config) if err := jmxConfig.validate(); err != nil { return nil, err