Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/apache]: change feature gates for server name and port resource attributes to beta #16483

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .chloggen/apache-server-port-feature-gates-beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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: apachereceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: turn on by default feature gates for server name and port resource attributes

# One or more tracking issues related to the change
issues: [14791]

# (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:
16 changes: 8 additions & 8 deletions receiver/apachereceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ Details about the metrics produced by this receiver can be found in [metadata.ya

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.apache.emitServerNameAsResourceAttribute`
**BETA**: `receiver.apache.emitServerNameAsResourceAttribute`

The feature gate `receiver.apache.emitServerNameAsResourceAttribute` once enabled starts emitting the metrics with a resource attribute `apache.server.name`. When the feature gate is disabled, the metrics are emitted with a `server_name` metric-level attribute instead.

This is considered a breaking change for existing users of this receiver, and it is recommended to migrate to the new implementation when possible. Any new users planning to adopt this receiver should enable this feature gate to avoid having to migrate any visualisations or alerts.

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.66.0.
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 the old implementation to be removed
is 0.69.0.

**ALPHA**: `receiver.apache.emitPortAsResourceAttribute`
**BETA**: `receiver.apache.emitPortAsResourceAttribute`

The feature gate `receiver.apache.emitPortAsResourceAttribute` once enabled starts emitting the metrics with a resource attribute `apache.server.port`.

This is considered a breaking change for existing users of this receiver, and it is recommended to migrate to the new implementation when possible. Any new users planning to adopt this receiver should enable this feature gate to avoid having to migrate any visualisations or alerts.

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.66.0.
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 the old implementation to be removed
is 0.69.0.
5 changes: 5 additions & 0 deletions receiver/apachereceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/testcontainers/testcontainers-go/wait"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/featuregate"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/scrapertest"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/scrapertest/golden"
Expand All @@ -55,6 +56,10 @@ func TestApacheIntegration(t *testing.T) {
hostname, err := container.Host(context.Background())
require.NoError(t, err)

// Let this test check if it works with the features disabled and the unit test will test the feature enabled.
err = featuregate.GetRegistry().Apply(map[string]bool{EmitServerNameAsResourceAttribute: false, EmitPortAsResourceAttribute: false})
require.NoError(t, err)

f := NewFactory()
cfg := f.CreateDefaultConfig().(*Config)
cfg.ScraperControllerSettings.CollectionInterval = 100 * time.Millisecond
Expand Down
4 changes: 2 additions & 2 deletions receiver/apachereceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ const (
func init() {
featuregate.GetRegistry().MustRegisterID(
EmitServerNameAsResourceAttribute,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the name of the server will be sent as an apache.server.name resource attribute instead of a metric-level server_name attribute."),
)
featuregate.GetRegistry().MustRegisterID(
EmitPortAsResourceAttribute,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the port of the server will be sent as an apache.server.port resource attribute."),
)
}
Expand Down
3 changes: 0 additions & 3 deletions receiver/apachereceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/featuregate"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/scrapertest"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/scrapertest/golden"
Expand All @@ -43,8 +42,6 @@ func TestScraper(t *testing.T) {
require.NoError(t, component.ValidateConfig(cfg))

// Let this test check if it works with the feature enabled and the integration test will test the feature disabled.
err := featuregate.GetRegistry().Apply(map[string]bool{EmitServerNameAsResourceAttribute: true, EmitPortAsResourceAttribute: true})
require.NoError(t, err)

serverName, port, err := parseResourseAttributes(cfg.Endpoint)
require.NoError(t, err)
Expand Down