Skip to content

Commit

Permalink
Log message to announce direction attribute feature gate deprecation (
Browse files Browse the repository at this point in the history
#14129)

* Log message to announce `direction` attribute feature gate deprecation

The change to remove the `direction` attribute has been reverted in the specification. As a result, the following feature gates will be removed in v0.62.0:
  - `receiver.elasticsearchreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.elasticsearchreceiver.emitMetricsWithoutDirectionAttribute`
  - `receiver.hostmetricsreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.hostmetricsreceiver.emitMetricsWithoutDirectionAttribute`
  - `receiver.kubelestatsreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.kubelestatsreceiver.emitMetricsWithoutDirectionAttribute`
  - `receiver.memcachedreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.memcachedreceiver.emitMetricsWithoutDirectionAttribute`
  - `receiver.vcenterreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.vcenterreceiver.emitMetricsWithoutDirectionAttribute`
  - `receiver.zookeeperreceiver.emitMetricsWithDirectionAttribute`
  - `receiver.zookeeperreceiver.emitMetricsWithoutDirectionAttribute`
  • Loading branch information
Alex Boten committed Sep 16, 2022
1 parent 2e6b6ff commit c0666b6
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 197 deletions.
19 changes: 5 additions & 14 deletions receiver/elasticsearchreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,13 @@ Details about the metrics produced by this receiver can be found in [metadata.ya

#### Transition from metrics with "direction" attribute

There is a proposal to change some elasticsearch metrics from being reported with a `direction` attribute to being
reported with the direction included in the metric name.
The proposal to change metrics from being reported with a `direction` attribute has been reverted in the specification. As a result, the
following feature gates will be removed in v0.62.0:

- `elasticsearch.node.cluster.io` will become:
- `elasticsearch.node.cluster.io.received`
- `elasticsearch.node.cluster.io.sent`
- **receiver.elasticsearchreceiver.emitMetricsWithoutDirectionAttribute**
- **receiver.elasticsearchreceiver.emitMetricsWithDirectionAttribute**

The following feature gates control the transition process:

- **receiver.elasticsearchreceiver.emitMetricsWithoutDirectionAttribute**: controls if the new metrics without `direction` attribute are emitted by the receiver.
- **receiver.elasticsearchreceiver.emitMetricsWithDirectionAttribute**: controls if the deprecated metrics with `direction` attribute are emitted by the receiver.

##### Transition schedule:

The final decision on the transition is not finalized yet. The transition is on hold until
https://github.com/open-telemetry/opentelemetry-specification/issues/2726 is resolved.
For additional information, see https://github.com/open-telemetry/opentelemetry-specification/issues/2726.

[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
16 changes: 16 additions & 0 deletions receiver/elasticsearchreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.opentelemetry.io/collector/service/featuregate"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver/internal/metadata"
)
Expand Down Expand Up @@ -61,6 +63,12 @@ func createDefaultConfig() config.Receiver {

var errConfigNotES = errors.New("config was not an elasticsearch receiver config")

func logDeprecatedFeatureGateForDirection(log *zap.Logger, gate featuregate.Gate) {
log.Warn("WARNING: The " + gate.ID + " feature gate is deprecated and will be removed in the next release. The change to remove " +
"the direction attribute has been reverted in the specification. See https://github.com/open-telemetry/opentelemetry-specification/issues/2726 " +
"for additional details.")
}

// createMetricsReceiver creates a metrics receiver for scraping elasticsearch metrics.
func createMetricsReceiver(
_ context.Context,
Expand All @@ -73,6 +81,14 @@ func createMetricsReceiver(
return nil, errConfigNotES
}
es := newElasticSearchScraper(params, c)

if !es.emitMetricsWithDirectionAttribute {
logDeprecatedFeatureGateForDirection(es.settings.Logger, emitMetricsWithDirectionAttributeFeatureGate)
}

if es.emitMetricsWithoutDirectionAttribute {
logDeprecatedFeatureGateForDirection(es.settings.Logger, emitMetricsWithoutDirectionAttributeFeatureGate)
}
scraper, err := scraperhelper.NewScraper(typeStr, es.scrape, scraperhelper.WithStart(es.start))
if err != nil {
return nil, err
Expand Down
80 changes: 5 additions & 75 deletions receiver/hostmetricsreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,83 +135,13 @@ service:

#### Transition from metrics with "direction" attribute

There is a proposal to change some host metrics from being reported with a `direction` attribute to being
reported with the direction included in the metric name.

- `disk` scraper metrics:
- `system.disk.io` will become:
- `system.disk.io.read`
- `system.disk.io.write`
- `system.disk.operations` will become:
- `system.disk.operations.read`
- `system.disk.operations.write`
- `system.disk.operation_time` will become:
- `system.disk.operation_time.read`
- `system.disk.operation_time.write`
- `system.disk.merged` will become:
- `system.disk.merged.read`
- `system.disk.merged.write`
- `network` scraper metrics:
- `system.network.dropped` will become:
- `system.network.dropped.receive`
- `system.network.dropped.transmit`
- `system.network.errors` will become:
- `system.network.errors.receive`
- `system.network.errors.transmit`
- `system.network.io` will become:
- `system.network.io.receive`
- `system.network.io.transmit`
- `system.network.packets` will become:
- `system.network.packets.receive`
- `system.network.packets.transmit`
- `paging` scraper metrics:
- `system.paging.operations` will become:
- `system.paging.operations.page_in`
- `system.paging.operations.page_out`
- `process` scraper metrics:
- `process.disk.io` will become:
- `process.disk.io.read`
- `process.disk.io.write`

The following feature gates control the transition process:

- **receiver.hostmetricsreceiver.emitMetricsWithoutDirectionAttribute**: controls if the new metrics without
`direction` attribute are emitted by the receiver.
- **receiver.hostmetricsreceiver.emitMetricsWithDirectionAttribute**: controls if the deprecated metrics with
`direction`
attribute are emitted by the receiver.

##### Transition schedule:

The final decision on the transition is not finalized yet. The transition is on hold until
https://github.com/open-telemetry/opentelemetry-specification/issues/2726 is resolved.

##### Usage:

To enable the new metrics without `direction` attribute and disable the deprecated metrics, run OTel Collector with the
following arguments:

```sh
otelcol --feature-gates=-receiver.hostmetricsreceiver.emitMetricsWithDirectionAttribute,+receiver.hostmetricsreceiver.emitMetricsWithoutDirectionAttribute
```

It's also possible to emit both the deprecated and the new metrics:
The proposal to change metrics from being reported with a `direction` attribute has been reverted in the specification. As a result, the
following feature gates will be removed in v0.62.0:

```sh
otelcol --feature-gates=+receiver.hostmetricsreceiver.emitMetricsWithDirectionAttribute,+receiver.hostmetricsreceiver.emitMetricsWithoutDirectionAttribute
```
- **receiver.hostmetricsreceiver.emitMetricsWithoutDirectionAttribute**
- **receiver.hostmetricsreceiver.emitMetricsWithDirectionAttribute**

If both feature gates are enabled, each particular metric can be disabled with the user settings, for example:

```yaml
receivers:
hostmetrics:
scrapers:
paging:
metrics:
system.paging.operations:
enabled: false
```
For additional information, see https://github.com/open-telemetry/opentelemetry-specification/issues/2726.

##### More information:

Expand Down
15 changes: 15 additions & 0 deletions receiver/hostmetricsreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.opentelemetry.io/collector/service/featuregate"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/cpuscraper"
Expand Down Expand Up @@ -101,6 +103,12 @@ func createMetricsReceiver(
)
}

func logDeprecatedFeatureGateForDirection(log *zap.Logger, gateID string) {
log.Warn("WARNING: The " + gateID + " feature gate is deprecated and will be removed in the next release. The change to remove " +
"the direction attribute has been reverted in the specification. See https://github.com/open-telemetry/opentelemetry-specification/issues/2726 " +
"for additional details.")
}

func createAddScraperOptions(
ctx context.Context,
set component.ReceiverCreateSettings,
Expand All @@ -123,6 +131,13 @@ func createAddScraperOptions(
return nil, fmt.Errorf("host metrics scraper factory not found for key: %q", key)
}

if !featuregate.GetRegistry().IsEnabled(internal.EmitMetricsWithDirectionAttributeFeatureGateID) {
logDeprecatedFeatureGateForDirection(set.Logger, internal.EmitMetricsWithDirectionAttributeFeatureGateID)
}
if featuregate.GetRegistry().IsEnabled(internal.EmitMetricsWithoutDirectionAttributeFeatureGateID) {
logDeprecatedFeatureGateForDirection(set.Logger, internal.EmitMetricsWithoutDirectionAttributeFeatureGateID)
}

return scraperControllerOptions, nil
}

Expand Down
22 changes: 5 additions & 17 deletions receiver/kubeletstatsreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,13 @@ Details about the metrics produced by this receiver can be found in [metadata.ya

#### Transition from metrics with "direction" attribute

There is a proposal to change some host metrics from being reported with a `direction` attribute to being
reported with the direction included in the metric name.
The proposal to change metrics from being reported with a `direction` attribute has been reverted in the specification. As a result, the
following feature gates will be removed in v0.62.0:

- `k8s.node.network.io` will become:
- `k8s.node.network.io.transmit`
- `k8s.node.network.io.receive`
- `k8s.node.network.errors` will become:
- `k8s.node.network.errors.transmit`
- `k8s.node.network.errors.receive`
- **receiver.kubeletstatsreceiver.emitMetricsWithoutDirectionAttribute**
- **receiver.kubeletstatsreceiver.emitMetricsWithDirectionAttribute**

The following feature gates control the transition process:

- **receiver.kubeletstatsreceiver.emitMetricsWithoutDirectionAttribute**: controls if the new metrics without `direction` attribute are emitted by the receiver.
- **receiver.kubeletstatsreceiver.emitMetricsWithDirectionAttribute**: controls if the deprecated metrics with `direction` attribute are emitted by the receiver.

##### Transition schedule:

The final decision on the transition is not finalized yet. The transition is on hold until
https://github.com/open-telemetry/opentelemetry-specification/issues/2726 is resolved.
For additional information, see https://github.com/open-telemetry/opentelemetry-specification/issues/2726.

[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
13 changes: 13 additions & 0 deletions receiver/kubeletstatsreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ type kubletScraper struct {
emitMetricsWithoutDirectionAttribute bool
}

func logDeprecatedFeatureGateForDirection(log *zap.Logger, gate featuregate.Gate) {
log.Warn("WARNING: The " + gate.ID + " feature gate is deprecated and will be removed in the next release. The change to remove " +
"the direction attribute has been reverted in the specification. See https://github.com/open-telemetry/opentelemetry-specification/issues/2726 " +
"for additional details.")
}

func newKubletScraper(
restClient kubelet.RestClient,
set component.ReceiverCreateSettings,
Expand All @@ -109,6 +115,13 @@ func newKubletScraper(
emitMetricsWithDirectionAttribute: featuregate.GetRegistry().IsEnabled(emitMetricsWithDirectionAttributeFeatureGateID),
emitMetricsWithoutDirectionAttribute: featuregate.GetRegistry().IsEnabled(emitMetricsWithoutDirectionAttributeFeatureGateID),
}
if !ks.emitMetricsWithDirectionAttribute {
logDeprecatedFeatureGateForDirection(ks.logger, emitMetricsWithDirectionAttributeFeatureGate)
}

if ks.emitMetricsWithoutDirectionAttribute {
logDeprecatedFeatureGateForDirection(ks.logger, emitMetricsWithoutDirectionAttributeFeatureGate)
}
return scraperhelper.NewScraper(typeStr, ks.scrape)
}

Expand Down
22 changes: 5 additions & 17 deletions receiver/memcachedreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,13 @@ Details about the metrics produced by this receiver can be found in [metadata.ya

#### Transition from metrics with "direction" attribute

There is a proposal to change some memcached metrics from being reported with a `direction` attribute to being
reported with the direction included in the metric name.
The proposal to change metrics from being reported with a `direction` attribute has been reverted in the specification. As a result, the
following feature gates will be removed in v0.62.0:

- `memcached.network` will become:
- `memcached.network.sent`
- `memcached.network.received`
- **receiver.memcachedreceiver.emitMetricsWithoutDirectionAttribute**
- **receiver.memcachedreceiver.emitMetricsWithDirectionAttribute**

The following feature gates control the transition process:

- **receiver.memcachedreceiver.emitMetricsWithoutDirectionAttribute**: controls if the new metrics without
`direction` attribute are emitted by the receiver.
- **receiver.memcachedreceiver.emitMetricsWithDirectionAttribute**: controls if the deprecated metrics with
`direction`
attribute are emitted by the receiver.

##### Transition schedule:

The final decision on the transition is not finalized yet. The transition is on hold until
https://github.com/open-telemetry/opentelemetry-specification/issues/2726 is resolved.
For additional information, see https://github.com/open-telemetry/opentelemetry-specification/issues/2726.

[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
17 changes: 17 additions & 0 deletions receiver/memcachedreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.opentelemetry.io/collector/service/featuregate"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/memcachedreceiver/internal/metadata"
)
Expand Down Expand Up @@ -57,6 +59,12 @@ func createDefaultConfig() config.Receiver {
}
}

func logDeprecatedFeatureGateForDirection(log *zap.Logger, gate featuregate.Gate) {
log.Warn("WARNING: The " + gate.ID + " feature gate is deprecated and will be removed in the next release. The change to remove " +
"the direction attribute has been reverted in the specification. See https://github.com/open-telemetry/opentelemetry-specification/issues/2726 " +
"for additional details.")
}

func createMetricsReceiver(
_ context.Context,
params component.ReceiverCreateSettings,
Expand All @@ -66,6 +74,15 @@ func createMetricsReceiver(
cfg := rConf.(*Config)

ms := newMemcachedScraper(params, cfg)

if !ms.emitMetricsWithDirectionAttribute {
logDeprecatedFeatureGateForDirection(ms.logger, emitMetricsWithDirectionAttributeFeatureGate)
}

if ms.emitMetricsWithoutDirectionAttribute {
logDeprecatedFeatureGateForDirection(ms.logger, emitMetricsWithoutDirectionAttributeFeatureGate)
}

scraper, err := scraperhelper.NewScraper(typeStr, ms.scrape)
if err != nil {
return nil, err
Expand Down
47 changes: 7 additions & 40 deletions receiver/vcenterreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,46 +51,13 @@ Details about the metrics produced by this receiver can be found in [metadata.ya

#### Transition from metrics with "direction" attribute

There is a proposal to change some memcached metrics from being reported with a `direction` attribute to being
reported with the direction included in the metric name.

- `vcenter.host.disk.throughput` will become:
- `vcenter.host.disk.throughput.read`
- `vcenter.host.disk.throughput.write`
- `vcenter.host.disk.latency.avg` will become:
- `vcenter.host.disk.latency.avg.read`
- `vcenter.host.disk.latency.avg.write`
- `vcenter.host.network.throughput` will become:
- `vcenter.host.network.throughputt.receive`
- `vcenter.host.network.throughput.transmit`
- `vcenter.host.network.packet.errors` will become:
- `vcenter.host.network.packet.errors.receive`
- `vcenter.host.network.packet.errors.transmit`
- `vcenter.host.network.packet.count` will become:
- `vcenter.host.network.packet.count.receive`
- `vcenter.host.network.packet.count.transmit`
- `vcenter.vm.disk.latency.avg.read` will become:
- `vcenter.vm.disk.latency.avg.read`
- `vcenter.vm.disk.latency.avg.write`
- `vcenter.vm.network.throughput` will become:
- `vcenter.vm.network.throughput.receive`
- `vcenter.vm.network.throughput.transmit`
- `vcenter.vm.network.packet.count` will become:
- `vcenter.vm.network.packet.count.receive`
- `vcenter.vm.network.packet.count.transmit`

The following feature gates control the transition process:

- **receiver.vcenterreceiver.emitMetricsWithoutDirectionAttribute**: controls if the new metrics without
`direction` attribute are emitted by the receiver.
- **receiver.vcenterreceiver.emitMetricsWithDirectionAttribute**: controls if the deprecated metrics with
`direction`
attribute are emitted by the receiver.

##### Transition schedule:

The final decision on the transition is not finalized yet. The transition is on hold until
https://github.com/open-telemetry/opentelemetry-specification/issues/2726 is resolved.
The proposal to change metrics from being reported with a `direction` attribute has been reverted in the specification. As a result, the
following feature gates will be removed in v0.62.0:

- **receiver.vcenterreceiver.emitMetricsWithoutDirectionAttribute**
- **receiver.vcenterreceiver.emitMetricsWithDirectionAttribute**

For additional information, see https://github.com/open-telemetry/opentelemetry-specification/issues/2726.

[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
Loading

0 comments on commit c0666b6

Please sign in to comment.