Skip to content

Commit

Permalink
[receiver/mongodb] Bump receiver.mongodb.removeDatabaseAttr feature g…
Browse files Browse the repository at this point in the history
…ate to beta (open-telemetry#31212)
  • Loading branch information
djaglowski authored and XinRanZhAWS committed Mar 13, 2024
1 parent f884170 commit 41dcd5f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .chloggen/featuregate-mongo-beta.yaml
Original file line number Diff line number Diff line change
@@ -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: []
12 changes: 5 additions & 7 deletions receiver/mongodbreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
6 changes: 0 additions & 6 deletions receiver/mongodbreceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/mongodbreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
3 changes: 0 additions & 3 deletions receiver/mongodbreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 41dcd5f

Please sign in to comment.