Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
observability_bridge.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
5#pragma once
6#ifndef KCENON_NETWORK_INTERNAL_INTEGRATION_OBSERVABILITY_BRIDGE_H_
7#define KCENON_NETWORK_INTERNAL_INTEGRATION_OBSERVABILITY_BRIDGE_H_
8
49#include <memory>
50#include <mutex>
51#include <atomic>
52
53#if KCENON_WITH_COMMON_SYSTEM
54#include <kcenon/common/interfaces/logger_interface.h>
55#include <kcenon/common/interfaces/monitoring_interface.h>
56#endif
57
59
84public:
89 enum class BackendType {
92 };
93
108 explicit ObservabilityBridge(
109 std::shared_ptr<logger_interface> logger,
110 std::shared_ptr<monitoring_interface> monitor,
111 BackendType backend_type = BackendType::Standalone);
112
118 ~ObservabilityBridge() override;
119
120 // INetworkBridge interface implementation
121
150 VoidResult initialize(const BridgeConfig& config) override;
151
161 VoidResult shutdown() override;
162
167 bool is_initialized() const override;
168
181 BridgeMetrics get_metrics() const override;
182
183 // ObservabilityBridge-specific methods
184
198 std::shared_ptr<logger_interface> get_logger() const;
199
213 std::shared_ptr<monitoring_interface> get_monitor() const;
214
220
221 // Factory methods
222
223#if KCENON_WITH_COMMON_SYSTEM
244 static std::shared_ptr<ObservabilityBridge> from_common_system(
245 std::shared_ptr<::kcenon::common::interfaces::ILogger> logger,
246 std::shared_ptr<::kcenon::common::interfaces::IMonitor> monitor);
247#endif
248
249private:
250 std::shared_ptr<logger_interface> logger_;
251 std::shared_ptr<monitoring_interface> monitor_;
253 std::atomic<bool> initialized_{false};
254 mutable std::mutex metrics_mutex_;
257};
258
259} // namespace kcenon::network::integration
260
261// Backward compatibility namespace alias
262namespace network_system {
264}
265
266#endif // KCENON_NETWORK_INTERNAL_INTEGRATION_OBSERVABILITY_BRIDGE_H_
Unified interface for external system integration bridges.
Abstract interface for external system integration bridges.
Bridge for observability (logger + monitoring) integration implementing INetworkBridge.
BridgeMetrics get_metrics() const override
Get current metrics.
bool is_initialized() const override
Check if the bridge is initialized.
std::shared_ptr< logger_interface > get_logger() const
Get the logger interface.
std::shared_ptr< monitoring_interface > monitor_
VoidResult shutdown() override
Shutdown the bridge.
BackendType get_backend_type() const
Get the backend type.
ObservabilityBridge(std::shared_ptr< logger_interface > logger, std::shared_ptr< monitoring_interface > monitor, BackendType backend_type=BackendType::Standalone)
Construct bridge with logger and monitoring interfaces.
std::shared_ptr< monitoring_interface > get_monitor() const
Get the monitoring interface.
@ CommonSystem
Uses common_system's ILogger and IMonitor.
@ Standalone
Uses network_system's logger_interface and monitoring_interface.
Feature flags for network_system.
Logger system integration interface for network_system.
Monitoring system integration interface for network_system.
VoidResult initialize()
Initialize the network system with default production configuration.
Configuration for bridge initialization.
Metrics and health information for a bridge.