Skip to content

feat(metrics): add system uptime monitoring collector (#217)#250

Merged
kcenon merged 2 commits into
mainfrom
feature/issue-217-system-uptime-monitoring
Dec 10, 2025
Merged

feat(metrics): add system uptime monitoring collector (#217)#250
kcenon merged 2 commits into
mainfrom
feature/issue-217-system-uptime-monitoring

Conversation

@kcenon

@kcenon kcenon commented Dec 10, 2025

Copy link
Copy Markdown
Owner

Summary

  • Implement cross-platform system uptime monitoring to track boot time and system availability
  • Add uptime_collector following the established collector pattern (context_switch_collector)
  • Support all three platforms: Linux, macOS, and Windows
  • Add comprehensive unit tests (18 tests passing)

Changes

Implementation

  • include/kcenon/monitoring/collectors/uptime_collector.h - Header with uptime_metrics and collector classes
  • src/impl/uptime_collector.cpp - Main collector implementation
  • src/platform/linux_uptime_metrics.cpp - Linux: /proc/uptime parsing
  • src/platform/macos_uptime_metrics.cpp - macOS: sysctl(KERN_BOOTTIME)
  • src/platform/windows_uptime_metrics.cpp - Windows: GetTickCount64()
  • tests/test_uptime_collector.cpp - Unit tests

Metrics Collected

Metric Description Unit
system_uptime_seconds Time since system boot Seconds
system_boot_timestamp Unix timestamp of last boot Timestamp
system_idle_seconds Total system idle time (Linux only) Seconds

Platform Support

Platform API Availability
Linux /proc/uptime Full support (uptime + idle)
macOS sysctl(KERN_BOOTTIME) Uptime + boot timestamp
Windows GetTickCount64() Uptime + boot timestamp

Test Plan

  • Build passes on macOS (verified locally)
  • All 18 uptime collector tests pass
  • CI passes on all platforms (Linux, macOS, Windows)

Closes #217

Implement cross-platform system uptime monitoring to track boot time
and system availability for SLA compliance and stability analysis.

- Add uptime_collector with uptime_info_collector pattern
- Linux: Read /proc/uptime for uptime and idle seconds
- macOS: Use sysctl(KERN_BOOTTIME) for boot timestamp
- Windows: Use GetTickCount64() for uptime calculation
- Add comprehensive unit tests (18 tests passing)

Metrics collected:
- system_uptime_seconds: Time since boot
- system_boot_timestamp: Unix timestamp of last boot
- system_idle_seconds: Total idle time (Linux only)
- Add system uptime monitoring section to FEATURES.md
- Add uptime_collector API reference to API_REFERENCE.md
- Update CHANGELOG.md and CHANGELOG_KO.md with new feature
@kcenon kcenon merged commit d558b6f into main Dec 10, 2025
21 checks passed
@kcenon kcenon deleted the feature/issue-217-system-uptime-monitoring branch December 10, 2025 00:47
kcenon added a commit that referenced this pull request Apr 13, 2026
* feat(metrics): add system uptime monitoring collector (#217)

Implement cross-platform system uptime monitoring to track boot time
and system availability for SLA compliance and stability analysis.

- Add uptime_collector with uptime_info_collector pattern
- Linux: Read /proc/uptime for uptime and idle seconds
- macOS: Use sysctl(KERN_BOOTTIME) for boot timestamp
- Windows: Use GetTickCount64() for uptime calculation
- Add comprehensive unit tests (18 tests passing)

Metrics collected:
- system_uptime_seconds: Time since boot
- system_boot_timestamp: Unix timestamp of last boot
- system_idle_seconds: Total idle time (Linux only)

* docs: update documentation for uptime collector (#217)

- Add system uptime monitoring section to FEATURES.md
- Add uptime_collector API reference to API_REFERENCE.md
- Update CHANGELOG.md and CHANGELOG_KO.md with new feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: System Uptime Monitoring

1 participant