Skip to content

refactor: Define NetworkMetricEvent struct for EventBus-based metric publishing #343

Description

@kcenon

Summary

Define the NetworkMetricEvent struct for EventBus-based metric publishing as part of the monitoring decoupling effort.

Parent Issue

Tasks

  • Create include/kcenon/network/events/ directory if not exists
  • Define NetworkMetricEvent struct with metric_name, value, timestamp, and labels
  • Add specialized network metric event types (connection, transfer, latency, error)
  • Ensure events satisfy common_system's concepts::EventType concept

Implementation

namespace kcenon::network::events {

struct NetworkMetricEvent {
    std::string metric_name;
    double value;
    std::chrono::steady_clock::time_point timestamp;
    std::map<std::string, std::string> labels;
    
    explicit NetworkMetricEvent(const std::string& name, double val,
        const std::map<std::string, std::string>& lbls = {})
        : metric_name(name), value(val),
          timestamp(std::chrono::steady_clock::now()),
          labels(lbls) {}
};

} // namespace kcenon::network::events

Acceptance Criteria

  • NetworkMetricEvent struct defined in new header
  • Satisfies common_system's EventType concept
  • Unit tests for event creation and serialization

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesExternal dependencies managementrefactoringCode refactoring and improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions