Skip to content

Conversation

@aaronc
Copy link
Member

@aaronc aaronc commented Jan 7, 2026

Description

Closes: #XXXX

This adds OpenTelemetry disk I/O instrumentation using https://pkg.go.dev/github.com/shirou/gopsutil/[email protected]/disk following the semantic conventions specified in https://opentelemetry.io/docs/specs/semconv/system/system-metrics/ and copying the code patterns in https://pkg.go.dev/go.opentelemetry.io/contrib/instrumentation/runtime as much as possible.

It also adds a cosmos_extra config option instrument_disk_io to enable this in otel.yaml.

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 7.64331% with 145 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.50%. Comparing base (8a694f0) to head (dc23ad0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
telemetry/util/diskio/diskio.go 2.67% 109 Missing ⚠️
telemetry/util/diskio/options.go 0.00% 22 Missing ⚠️
telemetry/config.go 0.00% 7 Missing ⚠️
telemetry/registry/registry.go 50.00% 3 Missing ⚠️
telemetry/util/host/host.go 60.00% 2 Missing ⚠️
telemetry/util/runtime/runtime.go 60.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #25745      +/-   ##
==========================================
- Coverage   70.84%   66.50%   -4.34%     
==========================================
  Files         890      929      +39     
  Lines       58024    60221    +2197     
==========================================
- Hits        41106    40051    -1055     
- Misses      16918    20170    +3252     
Files with missing lines Coverage Δ
telemetry/util/host/host.go 60.00% <60.00%> (ø)
telemetry/util/runtime/runtime.go 60.00% <60.00%> (ø)
telemetry/registry/registry.go 50.00% <50.00%> (ø)
telemetry/config.go 2.50% <0.00%> (+0.03%) ⬆️
telemetry/util/diskio/options.go 0.00% <0.00%> (ø)
telemetry/util/diskio/diskio.go 2.67% <2.67%> (ø)

... and 71 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 95 to 125
for device, s := range stats {
attrDevice := systemconv.DiskIO{}.AttrDevice(device)

// system.disk.io (bytes read/written)
o.ObserveInt64(diskIO, int64(s.ReadBytes),
metric.WithAttributes(attrDevice, attrDirectionRead))
o.ObserveInt64(diskIO, int64(s.WriteBytes),
metric.WithAttributes(attrDevice, attrDirectionWrite))

// system.disk.operations (read/write counts)
o.ObserveInt64(diskOps, int64(s.ReadCount),
metric.WithAttributes(attrDevice, attrDirectionRead))
o.ObserveInt64(diskOps, int64(s.WriteCount),
metric.WithAttributes(attrDevice, attrDirectionWrite))

// system.disk.io_time (seconds) - gopsutil returns milliseconds
o.ObserveFloat64(diskIOTime, float64(s.IoTime)/1000.0,
metric.WithAttributes(attrDevice))

// system.disk.operation_time (seconds) - gopsutil returns milliseconds
o.ObserveFloat64(diskOpTime, float64(s.ReadTime)/1000.0,
metric.WithAttributes(attrDevice, attrDirectionRead))
o.ObserveFloat64(diskOpTime, float64(s.WriteTime)/1000.0,
metric.WithAttributes(attrDevice, attrDirectionWrite))

// system.disk.merged (merged read/write operations)
o.ObserveInt64(diskMerged, int64(s.MergedReadCount),
metric.WithAttributes(attrDevice, attrDirectionRead))
o.ObserveInt64(diskMerged, int64(s.MergedWriteCount),
metric.WithAttributes(attrDevice, attrDirectionWrite))
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
metric.WithAttributes(attrDevice, attrDirectionWrite))

// system.disk.io_time (seconds) - gopsutil returns milliseconds
o.ObserveFloat64(diskIOTime, float64(s.IoTime)/1000.0,

Check notice

Code scanning / CodeQL

Floating point arithmetic

Floating point arithmetic operations are not associative and a possible source of non-determinism
metric.WithAttributes(attrDevice))

// system.disk.operation_time (seconds) - gopsutil returns milliseconds
o.ObserveFloat64(diskOpTime, float64(s.ReadTime)/1000.0,

Check notice

Code scanning / CodeQL

Floating point arithmetic

Floating point arithmetic operations are not associative and a possible source of non-determinism
// system.disk.operation_time (seconds) - gopsutil returns milliseconds
o.ObserveFloat64(diskOpTime, float64(s.ReadTime)/1000.0,
metric.WithAttributes(attrDevice, attrDirectionRead))
o.ObserveFloat64(diskOpTime, float64(s.WriteTime)/1000.0,

Check notice

Code scanning / CodeQL

Floating point arithmetic

Floating point arithmetic operations are not associative and a possible source of non-determinism
@technicallyty
Copy link
Contributor

can we merge this?

@technicallyty technicallyty marked this pull request as ready for review January 21, 2026 18:45
@github-actions github-actions bot added the C:CLI label Jan 21, 2026
@github-actions

This comment has been minimized.

@technicallyty technicallyty added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit c10bcb4 Jan 22, 2026
41 of 43 checks passed
@technicallyty technicallyty deleted the aaronc/telemetry-disk-io branch January 22, 2026 18:27
warpbuild-benchmark-bot bot added a commit to WarpBuilds/cosmos-sdk that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants