-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(telemetry): add disk I/O instrumentation utility #25745
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
| 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
| 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
| 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
| // 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
|
can we merge this? |
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_extraconfig optioninstrument_disk_ioto enable this inotel.yaml.