Skip to content

refactor: Consolidate monitoring_interface.h with common_system canonical definition #265

Description

@kcenon

5W1H Specification

  • Who: Maintainers, consumers of monitoring_system
  • What: Align monitoring_interface.h with common_system to eliminate interface duplication
  • Where: include/kcenon/monitoring/interfaces/monitoring_interface.h
  • When: Immediate (high priority - architectural consistency)
  • Why: Interface duplication violates Single Source of Truth; risks version drift and inconsistent behavior
  • How: Either re-export from common_system or consolidate definitions

Problem Statement

Current State

Two monitoring_interface.h files exist in the ecosystem:

Location Purpose
common_system/include/kcenon/common/interfaces/monitoring_interface.h Canonical IMonitor interface
monitoring_system/include/kcenon/monitoring/interfaces/monitoring_interface.h Extended monitoring interfaces

Issues

  1. Naming Collision: Same filename, different content
  2. Include Path Confusion: #include <.../monitoring_interface.h> ambiguous
  3. Interface Divergence Risk: Changes in one may not propagate to the other
  4. Dependency Graph Complexity: Unclear which is authoritative

Observed in Code Review

unified_system/
├── common_system/.../monitoring_interface.h      # IMonitor
├── monitoring_system/.../monitoring_interface.h  # extended interfaces
└── thread_system/... (uses one or both?)

Proposed Solution

Option A: Rename monitoring_system Interface (Recommended)

Rename to avoid collision:

monitoring_system/interfaces/monitoring_interface.h
  → monitoring_system/interfaces/metric_interfaces.h
  OR
  → monitoring_system/interfaces/monitoring_extensions.h

Option B: Re-export Pattern

monitoring_system/interfaces/monitoring_interface.h:

#pragma once
#include <kcenon/common/interfaces/monitoring_interface.h>

namespace kcenon::monitoring::interfaces {
    // Re-export common interface
    using ::kcenon::common::interfaces::IMonitor;
    
    // Extended interfaces specific to monitoring_system
    class IMetricCollector { ... };
}

Option C: Merge into common_system

If monitoring_system interfaces are universally needed:

  1. Move extended interfaces to common_system
  2. monitoring_system becomes pure implementation

Migration Steps

  1. Audit all usages of monitoring_interface.h across systems
  2. Choose consolidation strategy
  3. Update include paths in dependent systems
  4. Deprecate old paths with forwarding headers
  5. Remove deprecated headers in next major version

Acceptance Criteria

  • Single authoritative monitoring_interface.h OR clearly differentiated names
  • No ambiguous include paths
  • All dependent systems updated
  • Documentation updated with correct include paths

Impact

  • Priority: High (architectural consistency)
  • Effort: Medium (requires cross-repo coordination)
  • Breaking Change: Potentially (include path changes)

Related Systems

  • common_system (canonical interface location)
  • thread_system (consumer)
  • logger_system (consumer)
  • pacs_system (consumer)

Metadata

Metadata

Assignees

Labels

area/coreCore architecture and infrastructurepriority/highHigh priority - Critical for productiontype/refactorCode refactoring without functional changes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions