Skip to content

Commit d1d0261

Browse files
jonnangleFiery-Fenix
authored andcommitted
[receiver/awsecscontainermetrics] Aggregate I/O metrics from all devices (open-telemetry#38309)
#### Description Ensure that the storage.read_bytes and storage.write_bytes metrics include the i/o counts from all devices listed in `blkio_stats.io_service_bytes_recursive`. #### Link to tracking issue Fixes open-telemetry#38301 #### Testing I've extended the existing test condition to cover this general case.
1 parent 07bc54e commit d1d0261

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

.chloggen/ecs-io-metrics.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: awsecscontainermetrics
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Ensure that the storage.read_bytes and storage.write_bytes metrics include i/o counts from all devices
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [38301]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ func extractStorageUsage(stats *DiskStats) (uint64, uint64) {
110110
for _, blockStat := range stats.IoServiceBytesRecursives {
111111
switch op := blockStat.Op; op {
112112
case "Read":
113-
readBytes = aws.ToUint64(blockStat.Value)
113+
readBytes += aws.ToUint64(blockStat.Value)
114114
case "Write":
115-
writeBytes = aws.ToUint64(blockStat.Value)
115+
writeBytes += aws.ToUint64(blockStat.Value)
116+
116117
default:
117118
// ignoring "Async", "Total", "Sum", etc
118119
continue

receiver/awsecscontainermetricsreceiver/internal/awsecscontainermetrics/metrics_helper_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,17 +390,22 @@ func TestAggregateTaskMetrics(t *testing.T) {
390390

391391
func TestExtractStorageUsage(t *testing.T) {
392392
v := uint64(100)
393+
v2 := uint64(200)
393394
disk := &DiskStats{
394395
IoServiceBytesRecursives: []IoServiceBytesRecursive{
395396
{Op: "Read", Value: &v},
396397
{Op: "Write", Value: &v},
397398
{Op: "Total", Value: &v},
399+
400+
{Op: "Read", Value: &v2},
401+
{Op: "Write", Value: &v2},
402+
{Op: "Total", Value: &v2},
398403
},
399404
}
400405
read, write := extractStorageUsage(disk)
401406

402-
require.EqualValues(t, v, read)
403-
require.EqualValues(t, v, write)
407+
require.EqualValues(t, v+v2, read)
408+
require.EqualValues(t, v+v2, write)
404409

405410
read, write = extractStorageUsage(nil)
406411
v = uint64(0)

0 commit comments

Comments
 (0)