aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 14:27:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-09 15:27:32 +0100
commit084dc96bc564b814b7d8850958613cfae835dc77 (patch)
treea33bbbb6dac6c4277389478b154f2b4306eacb34 /src/lua/lua_config.c
parent0ebcb5c9fb90363a2afff95f3f1af827fcf9b287 (diff)
downloadrspamd-084dc96bc564b814b7d8850958613cfae835dc77.tar.gz
rspamd-084dc96bc564b814b7d8850958613cfae835dc77.zip
[Feature] Add support for Lua API tracing
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 2093cbe01..d7af3956f 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -841,6 +841,7 @@ lua_config_get_api_version (lua_State *L)
static gint
lua_config_get_module_opt (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *mname, *optname;
const ucl_object_t *obj;
@@ -863,6 +864,7 @@ lua_config_get_module_opt (lua_State * L)
static int
lua_config_get_mempool (lua_State * L)
{
+ LUA_TRACE_POINT;
rspamd_mempool_t **ppool;
struct rspamd_config *cfg = lua_check_config (L, 1);
@@ -880,6 +882,7 @@ lua_config_get_mempool (lua_State * L)
static int
lua_config_get_resolver (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_dns_resolver **pres;
struct rspamd_config *cfg = lua_check_config (L, 1);
@@ -898,6 +901,7 @@ lua_config_get_resolver (lua_State * L)
static gint
lua_config_get_all_opt (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *mname;
const ucl_object_t *obj, *cur, *cur_elt;
@@ -965,6 +969,7 @@ lua_config_ucl_dtor (gpointer p)
static gint
lua_config_get_ucl (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_cached_config *cached;
@@ -995,6 +1000,7 @@ lua_config_get_ucl (lua_State * L)
static gint
lua_config_get_classifier (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_classifier_config *clc = NULL, **pclc = NULL;
const gchar *name;
@@ -1432,6 +1438,7 @@ rspamd_register_symbol_fromlua (lua_State *L,
static gint
lua_config_register_post_filter (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint order = 0, cbref, ret;
@@ -1476,6 +1483,7 @@ lua_config_register_post_filter (lua_State *L)
static gint
lua_config_register_pre_filter (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint order = 0, cbref, ret;
@@ -1520,6 +1528,7 @@ lua_config_register_pre_filter (lua_State *L)
static gint
lua_config_get_key (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
size_t namelen;
@@ -1630,6 +1639,7 @@ lua_parse_symbol_type (const gchar *str)
static gint
lua_config_register_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL, *flags_str = NULL, *type_str = NULL,
*description = NULL, *group = NULL;
@@ -1733,6 +1743,7 @@ lua_config_register_symbol (lua_State * L)
static gint
lua_config_register_symbols (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint i, top, idx, ret = -1;
const gchar *sym;
@@ -1806,6 +1817,7 @@ lua_config_register_symbols (lua_State *L)
static gint
lua_config_register_virtual_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
double weight;
@@ -1834,6 +1846,7 @@ lua_config_register_virtual_symbol (lua_State * L)
static gint
lua_config_register_callback_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -1874,6 +1887,7 @@ lua_config_register_callback_symbol (lua_State * L)
static gint
lua_config_register_callback_symbol_priority (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -1952,6 +1966,7 @@ rspamd_lua_squeeze_dependency (lua_State *L, struct rspamd_config *cfg,
static gint
lua_config_register_dependency (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *parent = NULL, *child = NULL;
gint child_id;
@@ -2008,6 +2023,7 @@ lua_config_register_dependency (lua_State * L)
static gint
lua_config_set_metric_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *description = NULL,
*group = NULL, *name = NULL, *flags_str = NULL;
@@ -2107,6 +2123,7 @@ lua_config_set_metric_symbol (lua_State * L)
static gint
lua_config_get_metric_symbol (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym_name = luaL_checkstring (L, 2);
struct rspamd_symbol *sym_def;
@@ -2158,6 +2175,7 @@ lua_config_get_metric_symbol (lua_State * L)
static gint
lua_config_set_metric_action (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name = NULL;
double weight;
@@ -2196,6 +2214,7 @@ lua_config_set_metric_action (lua_State * L)
static gint
lua_config_get_metric_action (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *act_name = luaL_checkstring (L, 2);
gint act = 0;
@@ -2223,6 +2242,7 @@ lua_config_get_metric_action (lua_State * L)
static gint
lua_config_get_all_actions (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint act = 0;
@@ -2247,6 +2267,7 @@ lua_config_get_all_actions (lua_State * L)
static gint
lua_config_add_composite (lua_State * L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_expression *expr;
gchar *name;
@@ -2302,6 +2323,7 @@ lua_config_add_composite (lua_State * L)
static gint
lua_config_newindex (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *name;
gint id, nshots;
@@ -2530,6 +2552,7 @@ lua_config_newindex (lua_State *L)
static gint
lua_config_add_condition (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
gboolean ret = FALSE;
@@ -2554,6 +2577,7 @@ lua_config_add_condition (lua_State *L)
static gint
lua_config_set_peak_cb (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
gint condref;
@@ -2570,6 +2594,7 @@ lua_config_set_peak_cb (lua_State *L)
static gint
lua_config_enable_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
@@ -2586,6 +2611,7 @@ lua_config_enable_symbol (lua_State *L)
static gint
lua_config_disable_symbol (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
@@ -2602,6 +2628,7 @@ lua_config_disable_symbol (lua_State *L)
static gint
lua_config_register_regexp (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_regexp *re = NULL;
rspamd_regexp_t *cache_re;
@@ -2685,6 +2712,7 @@ lua_config_register_regexp (lua_State *L)
static gint
lua_config_replace_regexp (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_lua_regexp *old_re = NULL, *new_re = NULL;
GError *err = NULL;
@@ -2710,6 +2738,7 @@ lua_config_replace_regexp (lua_State *L)
static gint
lua_config_register_worker_script (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *worker_type = luaL_checkstring (L, 2), *wtype;
struct rspamd_worker_conf *cf;
@@ -2742,6 +2771,7 @@ lua_config_register_worker_script (lua_State *L)
static gint
lua_config_add_on_load (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_config_post_load_script *sc;
@@ -2831,6 +2861,7 @@ lua_periodic_callback (gint unused_fd, short what, gpointer ud)
static gint
lua_config_add_periodic (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct event_base *ev_base = lua_check_ev_base (L, 2);
gdouble timeout = lua_tonumber (L, 3);
@@ -2870,6 +2901,7 @@ lua_config_add_periodic (lua_State *L)
static gint
lua_config_get_symbols_count (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
guint res = 0;
@@ -2888,6 +2920,7 @@ lua_config_get_symbols_count (lua_State *L)
static gint
lua_config_get_symbols_cksum (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
guint64 res = 0, *pres;
@@ -2908,6 +2941,7 @@ lua_config_get_symbols_cksum (lua_State *L)
static gint
lua_config_get_symbols_counters (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
ucl_object_t *counters;
@@ -2945,6 +2979,7 @@ lua_metric_symbol_inserter (gpointer k, gpointer v, gpointer ud)
static gint
lua_config_get_symbols_scores (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -2964,6 +2999,7 @@ lua_config_get_symbols_scores (lua_State *L)
static gint
lua_config_get_symbol_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
struct rspamd_abstract_callback_data *abs_cbdata;
@@ -2996,6 +3032,7 @@ lua_config_get_symbol_callback (lua_State *L)
static gint
lua_config_set_symbol_callback (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
struct rspamd_abstract_callback_data *abs_cbdata;
@@ -3032,6 +3069,7 @@ lua_config_set_symbol_callback (lua_State *L)
static gint
lua_config_get_symbol_stat (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
gdouble freq, stddev, tm;
@@ -3069,6 +3107,7 @@ lua_config_get_symbol_stat (lua_State *L)
static gint
lua_config_register_finish_script (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_config_post_load_script *sc;
@@ -3088,6 +3127,7 @@ lua_config_register_finish_script (lua_State *L)
static gint
lua_config_register_monitored (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_monitored *m, **pm;
const gchar *url, *type;
@@ -3139,6 +3179,7 @@ lua_config_register_monitored (lua_State *L)
static gint
lua_config_add_doc (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg;
const gchar *path = NULL, *option, *doc_string;
const gchar *type_str = NULL, *default_value = NULL;
@@ -3187,6 +3228,7 @@ lua_config_add_doc (lua_State *L)
static gint
lua_config_add_example (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg;
const gchar *path = NULL, *option, *doc_string, *example;
gsize example_len;
@@ -3216,6 +3258,7 @@ lua_config_add_example (lua_State *L)
static gint
lua_config_get_cpu_flags (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_cryptobox_library_ctx *crypto_ctx;
@@ -3269,6 +3312,7 @@ lua_config_get_cpu_flags (lua_State *L)
static gint
lua_config_has_torch (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
struct rspamd_cryptobox_library_ctx *crypto_ctx;
@@ -3296,6 +3340,7 @@ lua_config_has_torch (lua_State *L)
static gint
lua_config_experimental_enabled (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3378,6 +3423,7 @@ lua_config_load_ucl (lua_State *L)
static gint
lua_config_parse_rcl (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
GHashTable *excluded = g_hash_table_new_full (rspamd_str_hash, rspamd_str_equal,
g_free, NULL);
@@ -3422,6 +3468,7 @@ lua_config_parse_rcl (lua_State *L)
static gint
lua_config_init_modules (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3438,6 +3485,7 @@ lua_config_init_modules (lua_State *L)
static gint
lua_config_init_subsystem (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *subsystem = luaL_checkstring (L, 2);
gchar **parts;
@@ -3473,6 +3521,7 @@ lua_config_init_subsystem (lua_State *L)
static gint
lua_config_get_tld_path (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
if (cfg != NULL) {
@@ -3488,6 +3537,7 @@ lua_config_get_tld_path (lua_State *L)
static gint
lua_monitored_alive (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3503,6 +3553,7 @@ lua_monitored_alive (lua_State *L)
static gint
lua_monitored_offline (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3518,6 +3569,7 @@ lua_monitored_offline (lua_State *L)
static gint
lua_monitored_total_offline (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {
@@ -3533,6 +3585,7 @@ lua_monitored_total_offline (lua_State *L)
static gint
lua_monitored_latency (lua_State *L)
{
+ LUA_TRACE_POINT;
struct rspamd_monitored *m = lua_check_monitored (L, 1);
if (m) {