5#include <gtest/gtest.h>
38 auto total_plugins = registry.plugin_count();
39 EXPECT_EQ(total_plugins, 9);
50 auto*
battery = registry.get_plugin(
"battery_collector");
55 EXPECT_FALSE(std::string(
battery->name()).empty());
59 auto total_plugins = registry.plugin_count();
60 EXPECT_EQ(total_plugins, 9);
71 auto stats = registry.get_registry_stats();
74 EXPECT_TRUE(stats.find(
"total_plugins") != stats.end());
85 auto*
battery = registry.get_plugin(
"battery_collector");
90 EXPECT_FALSE(std::string(
battery->name()).empty());
102 auto* uptime = registry.get_plugin(
"uptime_collector");
104 if (uptime !=
nullptr) {
107 bool init_result = uptime->initialize(config);
108 EXPECT_TRUE(init_result);
120 EXPECT_TRUE(registry.has_plugin(
"battery_collector"));
123 EXPECT_TRUE(registry.has_plugin(
"uptime_collector"));
126 EXPECT_FALSE(registry.has_plugin(
"non_existent_collector"));
Registration of built-in metric collectors with the registry.
static auto instance() -> collector_registry &
Get the singleton instance.
Registry for managing collector plugin lifecycle.
std::unordered_map< std::string, std::string > config_map
Type alias for configuration map.
@ battery
Battery power source.
bool register_builtin_collectors()
Register all built-in collectors with the collector_registry.
TEST_F(CollectorRegistryIntegrationTest, BuiltinCollectorsRegisteredWithRegistry)