From 7c1423ec21eb25d807b422248965f6466c8f3c39 Mon Sep 17 00:00:00 2001 From: Jimmy Ye Date: Mon, 16 Sep 2024 10:52:12 -0700 Subject: [PATCH] Use PlatformNameLib in sensor_service Reviewed By: Scott8440 Differential Revision: D62729447 fbshipit-source-id: 5158c9bf70574ce343eb145e93543816328c2dda --- cmake/PlatformSensorService.cmake | 1 + fboss/platform/sensor_service/BUCK | 1 + fboss/platform/sensor_service/SensorServiceImpl.cpp | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/PlatformSensorService.cmake b/cmake/PlatformSensorService.cmake index 79cbe51eeeb8d..36f768cacc987 100644 --- a/cmake/PlatformSensorService.cmake +++ b/cmake/PlatformSensorService.cmake @@ -50,6 +50,7 @@ add_library(sensor_service_lib target_link_libraries(sensor_service_lib log_thrift_call platform_config_lib + platform_name_lib platform_utils sensor_service_utils sensor_service_cpp2 diff --git a/fboss/platform/sensor_service/BUCK b/fboss/platform/sensor_service/BUCK index b1178b07f0229..5ebe19e2a810b 100644 --- a/fboss/platform/sensor_service/BUCK +++ b/fboss/platform/sensor_service/BUCK @@ -26,6 +26,7 @@ cpp_library( "//fboss/fsdb/if:fsdb_model", "//fboss/fsdb/if:fsdb_oper-cpp2-types", "//fboss/platform/config_lib:config_lib", + "//fboss/platform/helpers:platform_name_lib", "//fboss/platform/sensor_service/if:sensor_config-cpp2-types", "//fboss/platform/sensor_service/if:sensor_service-cpp2-types", "//folly:file_util", diff --git a/fboss/platform/sensor_service/SensorServiceImpl.cpp b/fboss/platform/sensor_service/SensorServiceImpl.cpp index 2c4626f58dc21..892b4f326b25f 100644 --- a/fboss/platform/sensor_service/SensorServiceImpl.cpp +++ b/fboss/platform/sensor_service/SensorServiceImpl.cpp @@ -18,6 +18,7 @@ #include #include "fboss/platform/config_lib/ConfigLib.h" +#include "fboss/platform/helpers/PlatformNameLib.h" #include "fboss/platform/sensor_service/FsdbSyncer.h" #include "fboss/platform/sensor_service/SensorServiceImpl.h" #include "fboss/platform/sensor_service/Utils.h" @@ -31,7 +32,8 @@ DEFINE_int32( namespace facebook::fboss::platform::sensor_service { SensorServiceImpl::SensorServiceImpl() { - std::string sensorConfJson = ConfigLib().getSensorServiceConfig(); + auto platformName = helpers::PlatformNameLib().getPlatformName(); + std::string sensorConfJson = ConfigLib().getSensorServiceConfig(platformName); XLOG(DBG2) << "Read sensor config: " << sensorConfJson; apache::thrift::SimpleJSONSerializer::deserialize( sensorConfJson, sensorConfig_);