Skip to content

[Feature]: System Uptime Monitoring #217

Description

@kcenon

What

Implement system uptime monitoring to track boot time and system availability.

  • Current: No uptime tracking exists
  • Expected: Boot timestamp, uptime duration, and availability metrics
  • Scope: Cross-platform implementation (Linux, macOS, Windows)

Why

  • Problem: Cannot track system stability or calculate availability SLOs
  • Impact: No visibility into unexpected reboots or system restarts
  • Value: Enables availability monitoring, SLA compliance tracking, stability analysis
  • Priority: Low - Simple to implement, useful for all environments

Where

  • Files: src/platform/linux_metrics.cpp, src/platform/windows_metrics.cpp, src/platform/macos_metrics.cpp
  • Integration: system_resource_collector.h (can extend existing collector)
  • Environment: All platforms
  • Related: system_resource_collector

How

Technical Approach

  1. Extend system_resource_collector or create standalone uptime_collector
  2. Platform-specific implementations:
    • Linux: Read /proc/uptime or use sysinfo() syscall
    • macOS: Use sysctl(KERN_BOOTTIME)
    • Windows: Use GetTickCount64() or QueryPerformanceCounter()
  3. Metrics to collect:
    • system_uptime_seconds: Time since boot
    • system_boot_timestamp: Unix timestamp of last boot
    • system_boot_count: (if available) Number of boots since install

Acceptance Criteria

  • Uptime metrics available on Linux via /proc/uptime
  • Uptime metrics available on macOS via sysctl
  • Uptime metrics available on Windows via GetTickCount64
  • Returns system_uptime_seconds (gauge)
  • Returns system_boot_timestamp (gauge)
  • Unit tests for each platform
  • Documentation updated

Platform APIs Reference

Platform API Notes
Linux /proc/uptime, sysinfo() Returns seconds.centiseconds
macOS sysctl(KERN_BOOTTIME) Returns boot time as timeval
Windows GetTickCount64() Returns milliseconds since boot

Size Estimate

size/S - Straightforward implementation using well-documented OS APIs

Metadata

Metadata

Assignees

Labels

area/metricsMetric collection and processingarea/platformPlatform-specific implementationenhancementNew feature or requestpriority/lowLow priority - Nice to havesize/SSmall - Less than 1 day of work

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions