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

exporter/signalfx: calculate extra disk I/O metrics #2557

Merged
merged 1 commit into from
Mar 5, 2021
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
119 changes: 119 additions & 0 deletions exporter/signalfxexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ func TestDefaultTranslationRules(t *testing.T) {
require.Equal(t, "disk", dps[3].Dimensions[2].Key)
require.Equal(t, "sda2", dps[3].Dimensions[2].Value)

// system.network.operations.total new metric calculation
dps, ok = metrics["system.disk.operations.total"]
require.True(t, ok, "system.network.operations.total metrics not found")
require.Equal(t, 4, len(dps))
require.Equal(t, 2, len(dps[0].Dimensions))

// system.network.io.total new metric calculation
dps, ok = metrics["system.disk.io.total"]
require.True(t, ok, "system.network.io.total metrics not found")
require.Equal(t, 2, len(dps))
require.Equal(t, 2, len(dps[0].Dimensions))
for _, dp := range dps {
require.Equal(t, "direction", dp.Dimensions[1].Key)
switch dp.Dimensions[1].Value {
case "write":
require.Equal(t, int64(11e9), *dp.Value.IntValue)
case "read":
require.Equal(t, int64(3e9), *dp.Value.IntValue)
}
}

// disk_ops.total gauge from system.disk.operations cumulative, where is disk_ops.total
// is the cumulative across devices and directions.
dps, ok = metrics["disk_ops.total"]
Expand Down Expand Up @@ -370,6 +391,104 @@ func testMetricsData() pdata.ResourceMetrics {
},
},
},
{
MetricDescriptor: &metricspb.MetricDescriptor{
Name: "system.disk.io",
Description: "Disk I/O.",
Type: metricspb.MetricDescriptor_CUMULATIVE_INT64,
LabelKeys: []*metricspb.LabelKey{
{Key: "host"},
{Key: "direction"},
{Key: "device"},
},
},
Timeseries: []*metricspb.TimeSeries{
{
StartTimestamp: &timestamppb.Timestamp{},
LabelValues: []*metricspb.LabelValue{{
Value: "host0",
HasValue: true,
}, {
Value: "read",
HasValue: true,
}, {
Value: "sda1",
HasValue: true,
}},
Points: []*metricspb.Point{{
Timestamp: &timestamppb.Timestamp{
Seconds: 1596000000,
},
Value: &metricspb.Point_Int64Value{
Int64Value: 1e9,
},
}},
},
{
StartTimestamp: &timestamppb.Timestamp{},
LabelValues: []*metricspb.LabelValue{{
Value: "host0",
HasValue: true,
}, {
Value: "read",
HasValue: true,
}, {
Value: "sda2",
HasValue: true,
}},
Points: []*metricspb.Point{{
Timestamp: &timestamppb.Timestamp{
Seconds: 1596000000,
},
Value: &metricspb.Point_Int64Value{
Int64Value: 2e9,
},
}},
},
{
StartTimestamp: &timestamppb.Timestamp{},
LabelValues: []*metricspb.LabelValue{{
Value: "host0",
HasValue: true,
}, {
Value: "write",
HasValue: true,
}, {
Value: "sda1",
HasValue: true,
}},
Points: []*metricspb.Point{{
Timestamp: &timestamppb.Timestamp{
Seconds: 1596000000,
},
Value: &metricspb.Point_Int64Value{
Int64Value: 3e9,
},
}},
},
{
StartTimestamp: &timestamppb.Timestamp{},
LabelValues: []*metricspb.LabelValue{{
Value: "host0",
HasValue: true,
}, {
Value: "write",
HasValue: true,
}, {
Value: "sda2",
HasValue: true,
}},
Points: []*metricspb.Point{{
Timestamp: &timestamppb.Timestamp{
Seconds: 1596000000,
},
Value: &metricspb.Point_Int64Value{
Int64Value: 8e9,
},
}},
},
},
},
{
MetricDescriptor: &metricspb.MetricDescriptor{
Name: "system.disk.operations",
Expand Down
21 changes: 20 additions & 1 deletion exporter/signalfxexporter/translation/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,25 @@ translation_rules:
disk.summary_utilization: 100


# convert disk I/O metrics
# Translations to derive disk I/O metrics.

## Calculate extra system.disk.operations.total and system.disk.io.total metrics summing up read/write ops/IO across all devices.
- action: copy_metrics
mapping:
system.disk.operations: system.disk.operations.total
system.disk.io: system.disk.io.total
- action: aggregate_metric
metric_name: system.disk.operations.total
aggregation_method: sum
without_dimensions:
- device
- action: aggregate_metric
metric_name: system.disk.io.total
aggregation_method: sum
without_dimensions:
- device

## Calculate an extra disk_ops.total metric as number all all read and write operations happened since the last report.
- action: copy_metrics
mapping:
system.disk.operations: disk.ops
Expand All @@ -501,6 +519,7 @@ translation_rules:
- action: delta_metric
mapping:
disk.ops: disk_ops.total

- action: rename_dimension_keys
metric_names:
system.disk.merged: true
Expand Down