diff --git a/velox/common/config/CMakeLists.txt b/velox/common/config/CMakeLists.txt index 94404bed10f19..c37336f686867 100644 --- a/velox/common/config/CMakeLists.txt +++ b/velox/common/config/CMakeLists.txt @@ -12,17 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (${VELOX_BUILD_TESTING}) +if(${VELOX_BUILD_TESTING}) add_subdirectory(tests) -endif () +endif() velox_add_library(velox_global_config OBJECT GlobalConfig.cpp) velox_add_library(velox_common_config Config.cpp) velox_link_libraries( velox_common_config - PUBLIC velox_common_base - velox_global_config - velox_exception + PUBLIC velox_common_base velox_global_config velox_exception PRIVATE re2::re2) - diff --git a/velox/dwio/common/tests/CMakeLists.txt b/velox/dwio/common/tests/CMakeLists.txt index 09b19c2971dc2..29944d6081d70 100644 --- a/velox/dwio/common/tests/CMakeLists.txt +++ b/velox/dwio/common/tests/CMakeLists.txt @@ -62,6 +62,7 @@ target_link_libraries( velox_dwio_common_test velox_dwio_common_test_utils velox_temp_path + velox_global_config velox_vector_test_lib Boost::regex velox_link_libs diff --git a/velox/dwio/common/tests/LoggedExceptionTest.cpp b/velox/dwio/common/tests/LoggedExceptionTest.cpp index 6eea7e8b5c788..0e5959d284775 100644 --- a/velox/dwio/common/tests/LoggedExceptionTest.cpp +++ b/velox/dwio/common/tests/LoggedExceptionTest.cpp @@ -15,6 +15,7 @@ */ #include #include +#include "velox/common/config/GlobalConfig.h" #include "velox/dwio/common/exception/Exception.h" using namespace facebook::velox::dwio::common::exception; @@ -24,13 +25,14 @@ namespace { void testTraceCollectionSwitchControl(bool enabled) { // Logged exception is system type of velox exception. // Disable rate control in the test. - FLAGS_velox_exception_user_stacktrace_rate_limit_ms = 0; - FLAGS_velox_exception_system_stacktrace_rate_limit_ms = 0; + config::globalConfig.exceptionUserStacktraceRateLimitMs = 0; + config::globalConfig.exceptionSystemStacktraceRateLimitMs = 0; - // NOTE: the user flag should not affect the tracing behavior of system type + // NOTE: the user config should not affect the tracing behavior of system type // of exception collection. - FLAGS_velox_exception_user_stacktrace_enabled = folly::Random::oneIn(2); - FLAGS_velox_exception_system_stacktrace_enabled = enabled ? true : false; + config::globalConfig.exceptionUserStacktraceEnabled = folly::Random::oneIn(2); + config::globalConfig.exceptionSystemStacktraceEnabled = enabled ? true : false; + try { throw LoggedException("Test error message"); } catch (VeloxException& e) { diff --git a/velox/flag_definitions/CMakeLists.txt b/velox/flag_definitions/CMakeLists.txt index 24d4d2b32bfb2..dd6a8d40dce39 100644 --- a/velox/flag_definitions/CMakeLists.txt +++ b/velox/flag_definitions/CMakeLists.txt @@ -12,4 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. velox_add_library(velox_flag_definitions OBJECT flags.cpp) -velox_link_libraries(velox_flag_definitions PRIVATE velox_global_config gflags::gflags) +velox_link_libraries(velox_flag_definitions PRIVATE velox_global_config + gflags::gflags)