Skip to content

refactor: Implement EventBus-based metric publishing in network_metrics #344

Description

@kcenon

Summary

Update metric_reporter to publish metrics via EventBus instead of direct monitoring_system dependency.

Parent Issue

Depends On

Files to Modify

  • src/metrics/network_metrics.cpp
  • include/kcenon/network/metrics/network_metrics.h

Implementation Approach

  1. Remove #if KCENON_WITH_MONITORING_SYSTEM guards
  2. Use common_system's EventBus to publish NetworkMetricEvent
  3. Maintain backward compatibility with existing metric_reporter API

Example

void metric_reporter::report_connection_accepted() {
    auto& bus = kcenon::common::get_event_bus();
    bus.publish(events::NetworkMetricEvent{
        metric_names::CONNECTIONS_TOTAL, 1.0,
        {{"event", "accepted"}}
    });
}

Acceptance Criteria

  • All metric_reporter methods use EventBus
  • No KCENON_WITH_MONITORING_SYSTEM guards in metrics code
  • Unit tests verify event publishing

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactoringCode refactoring and improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions