void elasticApmGetConfigOption()

in prod/native/extension/code/ModuleFunctionsImpl.cpp [29:57]


void elasticApmGetConfigOption(std::string_view optionName, zval *return_value) {
    auto value = configManager.getOptionValue(optionName, EAPM_GL(config_)->get());

    std::visit([return_value](auto &&arg) {
        using T = std::decay_t<decltype(arg)>;
        if constexpr (std::is_same_v<T, std::chrono::milliseconds>) {
            ZVAL_DOUBLE(return_value, arg.count());
            return;
        } else if constexpr (std::is_same_v<T, LogLevel>) {
            ZVAL_LONG(return_value, arg);
            return;
        } else if constexpr (std::is_same_v<T, bool>) {
            if (arg) {
                ZVAL_TRUE(return_value);
            } else {
                ZVAL_FALSE(return_value);
            }
            return;
        } else if constexpr (std::is_same_v<T, std::string>) {
            ZVAL_STRINGL(return_value, arg.c_str(), arg.length());
            return;
        } else if constexpr (std::is_same_v<T, std::size_t>) {
            ZVAL_LONG(return_value, arg);
            return;
        } else {
            ZVAL_NULL(return_value);
        }
    }, value);
}