From cd128f240bd81bfe5cf9e2318520b150495aedd1 Mon Sep 17 00:00:00 2001
From: Daniel Jaglowski <jaglows3@gmail.com>
Date: Wed, 14 Feb 2024 11:51:49 -0600
Subject: [PATCH] [receiver/elasticsearch] Remove
 receiver.elasticsearch.emitNodeVersionAttr feature gate (#31221)

---
 .../featuregate-elasticsearch-remove.yaml     | 27 +++++++++++++++++++
 receiver/elasticsearchreceiver/README.md      | 12 ---------
 receiver/elasticsearchreceiver/go.mod         |  2 +-
 receiver/elasticsearchreceiver/scraper.go     |  9 -------
 4 files changed, 28 insertions(+), 22 deletions(-)
 create mode 100755 .chloggen/featuregate-elasticsearch-remove.yaml

diff --git a/.chloggen/featuregate-elasticsearch-remove.yaml b/.chloggen/featuregate-elasticsearch-remove.yaml
new file mode 100755
index 000000000000..f3d08f1ecbb0
--- /dev/null
+++ b/.chloggen/featuregate-elasticsearch-remove.yaml
@@ -0,0 +1,27 @@
+# Use this changelog template to create an entry for release notes.
+
+# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
+change_type: breaking
+
+# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
+component: receiver/elasticsearch
+
+# A brief description of the change.  Surround your text with quotes ("") if it needs to start with a backtick (`).
+note: Remove receiver.elasticsearch.emitNodeVersionAttr feature gate
+
+# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
+issues: [31221]
+
+# (Optional) One or more lines of additional information to render under the primary note.
+# These lines will be padded with 2 spaces and then inserted directly into the document.
+# Use pipe (|) for multiline entries.
+subtext:
+
+# If your change doesn't affect end users or the exported elements of any package,
+# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
+# Optional: The change log or logs in which this entry should be included.
+# e.g. '[user]' or '[user, api]'
+# Include 'user' if the change is relevant to end users.
+# Include 'api' if there is a change to a library API.
+# Default: '[user]'
+change_logs: []
diff --git a/receiver/elasticsearchreceiver/README.md b/receiver/elasticsearchreceiver/README.md
index 40450623e6b3..ff7ed63a0c52 100644
--- a/receiver/elasticsearchreceiver/README.md
+++ b/receiver/elasticsearchreceiver/README.md
@@ -66,15 +66,3 @@ The following metric are available with versions:
 - `elasticsearch.cluster.state_update.time` >= [7.16.0](https://www.elastic.co/guide/en/elasticsearch/reference/7.16/release-notes-7.16.0.html)
 
 Details about the metrics produced by this receiver can be found in [metadata.yaml](./metadata.yaml)
-
-## Feature gate configurations
-
-See the [Collector feature gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md#collector-feature-gates) for an overview of feature gates in the collector.
-
-**BETA**: `receiver.elasticsearch.emitNodeVersionAttr`
-
-The feature gate `receiver.elasticsearch.emitNodeVersionAttr` when enabled will enrich all node metrics with an
-resource attribute representing the node version.
-
-This feature gate is enabled by default, and eventually the old implementation will be removed. It aims to give users time
-to migrate to the new implementation. The target release for this featuregate to be permanently enabled is 0.82.0.
diff --git a/receiver/elasticsearchreceiver/go.mod b/receiver/elasticsearchreceiver/go.mod
index 3dd4e989fdfe..fdee96c9c0d5 100644
--- a/receiver/elasticsearchreceiver/go.mod
+++ b/receiver/elasticsearchreceiver/go.mod
@@ -16,7 +16,6 @@ require (
 	go.opentelemetry.io/collector/config/configtls v0.94.1
 	go.opentelemetry.io/collector/confmap v0.94.1
 	go.opentelemetry.io/collector/consumer v0.94.1
-	go.opentelemetry.io/collector/featuregate v1.1.0
 	go.opentelemetry.io/collector/pdata v1.1.0
 	go.opentelemetry.io/collector/receiver v0.94.1
 	go.opentelemetry.io/otel/metric v1.23.1
@@ -94,6 +93,7 @@ require (
 	go.opentelemetry.io/collector/config/internal v0.94.1 // indirect
 	go.opentelemetry.io/collector/extension v0.94.1 // indirect
 	go.opentelemetry.io/collector/extension/auth v0.94.1 // indirect
+	go.opentelemetry.io/collector/featuregate v1.1.0 // indirect
 	go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
 	go.opentelemetry.io/otel v1.23.1 // indirect
 	go.opentelemetry.io/otel/exporters/prometheus v0.45.1 // indirect
diff --git a/receiver/elasticsearchreceiver/scraper.go b/receiver/elasticsearchreceiver/scraper.go
index eaca50dcbfb3..9c5850ee699c 100644
--- a/receiver/elasticsearchreceiver/scraper.go
+++ b/receiver/elasticsearchreceiver/scraper.go
@@ -11,7 +11,6 @@ import (
 
 	"github.com/hashicorp/go-version"
 	"go.opentelemetry.io/collector/component"
-	"go.opentelemetry.io/collector/featuregate"
 	"go.opentelemetry.io/collector/pdata/pcommon"
 	"go.opentelemetry.io/collector/pdata/pmetric"
 	"go.opentelemetry.io/collector/receiver"
@@ -30,14 +29,6 @@ var (
 		v, _ := version.NewVersion("7.13")
 		return v
 	}()
-
-	_ = featuregate.GlobalRegistry().MustRegister(
-		"receiver.elasticsearch.emitNodeVersionAttr",
-		featuregate.StageStable,
-		featuregate.WithRegisterToVersion("0.82.0"),
-		featuregate.WithRegisterDescription("All node metrics will be enriched with the node version resource attribute."),
-		featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16847"),
-	)
 )
 
 var errUnknownClusterStatus = errors.New("unknown cluster status")