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/elasticsearch]: change feature gates for cluster health and index operations to beta #17042

Merged
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/elastic-v0680-feature-gates.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: elasticsearchreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: change feature gates for cluster health and index operations to beta

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

# (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/elasticsearchreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ 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.elasticsearch.emitClusterHealthDetailedShardMetrics`
**BETA**: `receiver.elasticsearch.emitClusterHealthDetailedShardMetrics`

The feature gate `receiver.elasticsearch.emitClusterHealthDetailedShardMetrics` once enabled starts emitting the metric `elasticsearch.cluster.shards`
with two additional data points - one with `state` equal to `active_primary` and one with `state` equal to `unassigned_delayed`.

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.68.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.71.0.

**ALPHA**: `receiver.elasticsearch.emitAllIndexOperationMetrics`
**BETA**: `receiver.elasticsearch.emitAllIndexOperationMetrics`

The feature gate `receiver.elasticsearch.emitAllIndexOperationMetrics` once enabled starts emitting metrics `elasticsearch.index.operation.count`
and `elasticsearch.index.operation.time` with all possible data points - for every possible operation type and both shard aggregation types.
Expand All @@ -80,9 +80,9 @@ Because of the amount of added data points, this change might affect performance
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 risking unexpected slowdowns.

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.68.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.71.0.

[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
5 changes: 5 additions & 0 deletions receiver/elasticsearchreceiver/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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"
"go.opentelemetry.io/collector/receiver/receivertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/comparetest"
Expand Down Expand Up @@ -57,6 +58,10 @@ var (
)

func TestElasticsearchIntegration(t *testing.T) {
// 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{emitClusterHealthDetailedShardMetricsID: false, emitAllIndexOperationMetricsID: false})
require.NoError(t, err)

//Starts an elasticsearch docker container
t.Run("Running elasticsearch 7.9", func(t *testing.T) {
t.Parallel()
Expand Down
4 changes: 2 additions & 2 deletions receiver/elasticsearchreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ const (
func init() {
featuregate.GetRegistry().MustRegisterID(
emitClusterHealthDetailedShardMetricsID,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the elasticsearch.cluster.shards metric will be emitted with two more datapoints."),
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/14635"),
)
featuregate.GetRegistry().MustRegisterID(
emitAllIndexOperationMetricsID,
featuregate.StageAlpha,
featuregate.StageBeta,
featuregate.WithRegisterDescription("When enabled, the elasticsearch.index.operation.* metrics will be emitted with all possible datapoints."),
featuregate.WithRegisterReferenceURL("https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/14635"),
)
Expand Down
11 changes: 0 additions & 11 deletions receiver/elasticsearchreceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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"
"go.opentelemetry.io/collector/receiver/receivertest"
"go.opentelemetry.io/collector/receiver/scrapererror"

Expand All @@ -40,16 +39,6 @@ const fullExpectedMetricsPath = "./testdata/expected_metrics/full.json"
const skipClusterExpectedMetricsPath = "./testdata/expected_metrics/clusterSkip.json"
const noNodesExpectedMetricsPath = "./testdata/expected_metrics/noNodes.json"

func TestMain(m *testing.M) {
// Enable the feature gates before all tests to avoid flaky tests.
_ = featuregate.GetRegistry().Apply(map[string]bool{
emitClusterHealthDetailedShardMetricsID: true,
emitAllIndexOperationMetricsID: true,
})
code := m.Run()
os.Exit(code)
}

func TestScraper(t *testing.T) {
t.Parallel()

Expand Down