From 41dcd5f8fe2c171944b35e21973e7507875af129 Mon Sep 17 00:00:00 2001 From: Daniel Jaglowski Date: Thu, 15 Feb 2024 13:57:53 -0600 Subject: [PATCH] [receiver/mongodb] Bump receiver.mongodb.removeDatabaseAttr feature gate to beta (#31212) --- .chloggen/featuregate-mongo-beta.yaml | 27 ++++++++++++++++++++ receiver/mongodbreceiver/README.md | 12 ++++----- receiver/mongodbreceiver/integration_test.go | 6 ----- receiver/mongodbreceiver/scraper.go | 2 +- receiver/mongodbreceiver/scraper_test.go | 3 --- 5 files changed, 33 insertions(+), 17 deletions(-) create mode 100755 .chloggen/featuregate-mongo-beta.yaml diff --git a/.chloggen/featuregate-mongo-beta.yaml b/.chloggen/featuregate-mongo-beta.yaml new file mode 100755 index 000000000000..e04c5fed47bc --- /dev/null +++ b/.chloggen/featuregate-mongo-beta.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/mongodb + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Bump receiver.mongodb.removeDatabaseAttr feature gate to beta + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [31212] + +# (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/mongodbreceiver/README.md b/receiver/mongodbreceiver/README.md index 542aac9163dd..ab01a808c778 100644 --- a/receiver/mongodbreceiver/README.md +++ b/receiver/mongodbreceiver/README.md @@ -78,13 +78,11 @@ The following metric are available with versions: 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. -**ALPHA**: `receiver.mongodb.removeDatabaseAttr` +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. -The feature gate `receiver.mongodb.removeDatabaseAttr` once enabled will remove database name attribute, -because both resource and datapoint attributes are called database. +**BETA**: `receiver.mongodb.removeDatabaseAttr` -This feature gate will eventually be 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 enabled by default -is 0.94.0. +The feature gate `receiver.mongodb.removeDatabaseAttr` is enabled by default but may be disabled. +Unless disabled, it will remove the database name attribute from data points because it is already found on the resource. +This feature gate will eventually be removed. diff --git a/receiver/mongodbreceiver/integration_test.go b/receiver/mongodbreceiver/integration_test.go index ee5912d20658..e2d62a5c514f 100644 --- a/receiver/mongodbreceiver/integration_test.go +++ b/receiver/mongodbreceiver/integration_test.go @@ -11,12 +11,10 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/wait" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/confignet" - "go.opentelemetry.io/collector/featuregate" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/scraperinttest" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/pmetrictest" @@ -25,10 +23,6 @@ import ( const mongoPort = "27017" func TestIntegration(t *testing.T) { - // Simulate enable removeDatabaseAttrFeatureGate - err := featuregate.GlobalRegistry().Set(removeDatabaseAttrID, true) - require.NoError(t, err) - t.Run("4.0", integrationTest("4_0", []string{"/setup.sh"}, func(*Config) {})) t.Run("5.0", integrationTest("5_0", []string{"/setup.sh"}, func(*Config) {})) t.Run("4.4lpu", integrationTest("4_4lpu", []string{"/lpu.sh"}, func(cfg *Config) { diff --git a/receiver/mongodbreceiver/scraper.go b/receiver/mongodbreceiver/scraper.go index 8ad682c16acf..4bc94bcfd3ae 100644 --- a/receiver/mongodbreceiver/scraper.go +++ b/receiver/mongodbreceiver/scraper.go @@ -32,7 +32,7 @@ var ( removeDatabaseAttrFeatureGate = featuregate.GlobalRegistry().MustRegister( removeDatabaseAttrID, - featuregate.StageAlpha, + featuregate.StageBeta, featuregate.WithRegisterDescription("Remove duplicate database name attribute"), featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/24972"), featuregate.WithRegisterFromVersion("v0.90.0")) diff --git a/receiver/mongodbreceiver/scraper_test.go b/receiver/mongodbreceiver/scraper_test.go index 4ca8df8c7e79..deaff1229f93 100644 --- a/receiver/mongodbreceiver/scraper_test.go +++ b/receiver/mongodbreceiver/scraper_test.go @@ -289,9 +289,6 @@ func TestScraperScrape(t *testing.T) { scraper := newMongodbScraper(receivertest.NewNopCreateSettings(), scraperCfg) - // Set removeDatabaseAttr as true to simulate enable removeDatabaseAttrFeatureGate - scraper.removeDatabaseAttr = true - mc := tc.setupMockClient(t) if mc != nil { scraper.client = mc