Skip to content

Commit

Permalink
[receiver/hostmetrics] remove direction for paging metrics
Browse files Browse the repository at this point in the history
The following change adds the direction to the metric name, removing the `direction` attribute.

Fixes #11818
  • Loading branch information
Alex Boten committed Jun 30, 2022
1 parent 10f4bd0 commit 948bb30
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 33 deletions.
36 changes: 34 additions & 2 deletions receiver/hostmetricsreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,41 @@ service:
- Usage
- Feature gate identifiers prefixed with - will disable the gate and prefixing with + or with no prefix will enable the gate.
- Start the otelcol with the feature gate enabled:
- otelcol {other_arguments} --feature-gates=receiver.k8sclusterreceiver.reportCpuMetricsAsDouble
- otelcol {other_arguments} --feature-gates=receiver.hostmetricsreceiver.removeDirectionAttributeNetworkMetrics
- Start the otelcol with the feature gate disabled:
- otelcol {other_arguments} --feature-gates=-receiver.k8sclusterreceiver.reportCpuMetricsAsDouble
- otelcol {other_arguments} --feature-gates=-receiver.hostmetricsreceiver.removeDirectionAttributeNetworkMetrics
- More information:
- https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/11815
- https://github.com/open-telemetry/opentelemetry-specification/pull/2617
- `receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics`
- Description
- Some paging metrics reported by the hostmetricsreceiver are transitioning from being reported
with a direction attribute to being reported with the direction included in the metric name to adhere to the
OpenTelemetry specification. Please update any monitoring this might affect.
- Affected Metrics
- `system.paging.operations` will become:
- `system.paging.operations.page_in`
- `system.paging.operations.page_out`
- Stages and Timeline
- Alpha (current stage)
- In this stage the feature gate is disabled by default and must be enabled by the user. This allows users to preemptively opt in and start using the bug fix by enabling the feature gate.
- Collector version: v0.55.0
- Release Date: Early July 2022
- Beta
- In this stage the feature gate is enabled by default and can be disabled by the user.
- Collector version: v0.57.0
- Release Date: Early August 2022
- Generally Available
- In this stage the feature gate is permanently enabled and the feature gate is no longer available for anyone.
- Users could experience some friction in this stage, they may have to update monitoring for the affected metrics or be blocked from upgrading the collector to versions v0.59.0 and newer.
- Collector version: v0.59.0
- Release Date: Early September 2022
- Usage
- Feature gate identifiers prefixed with - will disable the gate and prefixing with + or with no prefix will enable the gate.
- Start the otelcol with the feature gate enabled:
- otelcol {other_arguments} --feature-gates=receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics
- Start the otelcol with the feature gate disabled:
- otelcol {other_arguments} --feature-gates=-receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics
- More information:
- https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/11815
- https://github.com/open-telemetry/opentelemetry-specification/pull/2617
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ These are the metrics available for this scraper.
| ---- | ----------- | ---- | ---- | ---------- |
| **system.paging.faults** | The number of page faults. | {faults} | Sum(Int) | <ul> <li>type</li> </ul> |
| **system.paging.operations** | The number of paging operations. | {operations} | Sum(Int) | <ul> <li>direction</li> <li>type</li> </ul> |
| **system.paging.operations.page_in** | The number of page_in operations. | {operations} | Sum(Int) | <ul> <li>type</li> </ul> |
| **system.paging.operations.page_out** | The number of page_out operations. | {operations} | Sum(Int) | <ul> <li>type</li> </ul> |
| **system.paging.usage** | Swap (unix) or pagefile (windows) usage. | By | Sum(Int) | <ul> <li>device</li> <li>state</li> </ul> |
| system.paging.utilization | Swap (unix) or pagefile (windows) utilization. | 1 | Gauge(Double) | <ul> <li>device</li> <li>state</li> </ul> |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/receiver/scraperhelper"
"go.opentelemetry.io/collector/service/featuregate"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver/internal/scraper/pagingscraper/internal/metadata"
Expand All @@ -29,8 +30,20 @@ import (
const (
// TypeStr the value of "type" key in configuration.
TypeStr = "paging"
// ID for a temporary feature gate"
removeDirectionAttributeFeatureGateID = "receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics"
)

var removeDirectionAttributeFeatureGate = featuregate.Gate{
ID: removeDirectionAttributeFeatureGateID,
Enabled: false,
Description: "Some paging metrics reported by the hostmetricsreceiver are transitioning from being reported " +
"with a direction attribute to being reported with the direction included in the metric name to adhere to the " +
"OpenTelemetry specification. You can control whether the hostmetricsreceiver reports metrics with a direction " +
"attribute using the " + removeDirectionAttributeFeatureGateID + " feature gate. For more details, see: " +
"https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md#feature-gate-configurations",
}

// Factory is the Factory for scraper.
type Factory struct {
}
Expand All @@ -50,10 +63,22 @@ func (f *Factory) CreateMetricsScraper(
) (scraperhelper.Scraper, error) {
cfg := config.(*Config)
s := newPagingScraper(ctx, settings, cfg)
logFeatureGateMessage(settings)

return scraperhelper.NewScraper(
TypeStr,
s.scrape,
scraperhelper.WithStart(s.start),
)
}

func logFeatureGateMessage(settings component.ReceiverCreateSettings) {
if featuregate.GetRegistry().IsEnabled(removeDirectionAttributeFeatureGateID) {
settings.Logger.Info("The " + removeDirectionAttributeFeatureGateID + " featre gate is enabled. This " +
"otel collector will report metrics without a direction attribute, which is good for future support")
} else {
settings.Logger.Info("WARNING - Breaking Change: " + removeDirectionAttributeFeatureGate.Description)
settings.Logger.Info("The feature gate " + removeDirectionAttributeFeatureGateID + " is disabled. This " +
"otel collector will report metrics with a direction attribute, be aware this will not be supported in the future")
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ metrics:
monotonic: true
attributes: [direction, type]

# produced when receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics feature gate is enabled
system.paging.operations.page_in:
enabled: true
description: The number of page_in operations.
unit: "{operations}"
sum:
value_type: int
aggregation: cumulative
monotonic: true
attributes: [type]

# produced when receiver.hostmetricsreceiver.removeDirectionAttributePagingMetrics feature gate is enabled
system.paging.operations.page_out:
enabled: true
description: The number of page_out operations.
unit: "{operations}"
sum:
value_type: int
aggregation: cumulative
monotonic: true
attributes: [type]

system.paging.faults:
enabled: true
description: The number of page faults.
Expand Down

0 comments on commit 948bb30

Please sign in to comment.