Skip to content

Commit

Permalink
Revert "WIP: temporarily enable the extraction of source text"
Browse files Browse the repository at this point in the history
This reverts commit e93c530c12f03547552449c1fb52437efb9b86cb.
  • Loading branch information
bazsi committed Jan 7, 2025
1 parent 7fe138f commit d54d015
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 54 deletions.
4 changes: 2 additions & 2 deletions lib/cfg-grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -567,14 +567,14 @@ expr_stmt
source_stmt
: KW_SOURCE string '{' source_content '}'
{
$$ = log_expr_node_new_source($2, $4, &@$);
$$ = log_expr_node_new_source($2, $4, &@1);
free($2);
}
;
dest_stmt
: KW_DESTINATION string '{' dest_content '}'
{
$$ = log_expr_node_new_destination($2, $4, &@$);
$$ = log_expr_node_new_destination($2, $4, &@1);
free($2);
}
;
Expand Down
10 changes: 0 additions & 10 deletions lib/cfg-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "logmpx.h"
#include "logpipe.h"
#include "metrics-pipe.h"
#include "cfg-source.h"

#include <string.h>

Expand Down Expand Up @@ -283,14 +282,6 @@ log_expr_node_new(gint layout, gint content, const gchar *name, LogExprNode *chi
self->line = yylloc->first_line;
self->column = yylloc->first_column;
}
if (yylloc && (debug_flag || 1))
{
CFG_LTYPE lloc = *yylloc;
lloc.last_column = 255;
GString *text = g_string_new("");
cfg_source_extract_source_text(configuration->lexer, &lloc, text);
self->expr_text = g_string_free(text, FALSE);
}
return self;
}

Expand All @@ -317,7 +308,6 @@ _log_expr_node_free(LogExprNode *self)
self->aux_destroy(self->aux);
g_free(self->name);
g_free(self->filename);
g_free(self->expr_text);
g_free(self);
}

Expand Down
1 change: 0 additions & 1 deletion lib/cfg-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ struct _LogExprNode
gchar *filename;
gint line, column;
gint child_id;
gchar *expr_text;
};

gint log_expr_node_lookup_flag(const gchar *flag);
Expand Down
23 changes: 3 additions & 20 deletions lib/filterx/filterx-expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "mainloop.h"
#include "stats/stats-registry.h"
#include "stats/stats-cluster-single.h"
#include "perf/perf.h"

void
filterx_expr_set_location_with_text(FilterXExpr *self, CFG_LTYPE *lloc, const gchar *text)
Expand All @@ -37,7 +36,7 @@ filterx_expr_set_location_with_text(FilterXExpr *self, CFG_LTYPE *lloc, const gc
self->lloc = g_new0(CFG_LTYPE, 1);
*self->lloc = *lloc;

if ((debug_flag || 1) && text)
if (debug_flag && text)
self->expr_text = g_strdup(text);
}

Expand All @@ -47,7 +46,7 @@ filterx_expr_set_location(FilterXExpr *self, CfgLexer *lexer, CFG_LTYPE *lloc)
if (!self->lloc)
self->lloc = g_new0(CFG_LTYPE, 1);
*self->lloc = *lloc;
if (debug_flag || 1)
if (debug_flag)
{
GString *res = g_string_sized_new(0);
cfg_source_extract_source_text(lexer, lloc, res);
Expand Down Expand Up @@ -111,7 +110,7 @@ _init_sc_key_name(FilterXExpr *self, gchar *buf, gsize buf_len)
gboolean
filterx_expr_init_method(FilterXExpr *self, GlobalConfig *cfg)
{
gchar buf[256];
gchar buf[64];

_init_sc_key_name(self, buf, sizeof(buf));
stats_lock();
Expand All @@ -124,22 +123,6 @@ filterx_expr_init_method(FilterXExpr *self, GlobalConfig *cfg)
stats_cluster_single_key_set(&sc_key, buf, labels, labels_len);
stats_register_counter(STATS_LEVEL3, &sc_key, SC_TYPE_SINGLE_VALUE, &self->eval_count);
stats_unlock();

if (!perf_is_trampoline_address(self->eval))
{
//g_snprintf(buf, sizeof(buf), "filterx_%s_eval(%s)", self->type, self->name ? : "anon");
if (self->lloc)
// g_snprintf(buf, sizeof(buf), "filterx::%s:%d:%d|\t%s",
// self->lloc->name, self->lloc->first_line, self->lloc->first_column,
// self->expr_text ? : "n/a");
g_snprintf(buf, sizeof(buf), "filterx::%s", self->expr_text ? : "n/a");
else
g_snprintf(buf, sizeof(buf), "filterx::%s(%s)", self->type, self->name ? : "anon");
// msg_error("installing trampoline on expr",
// evt_tag_str("expr", buf));
self->eval = perf_generate_trampoline(self->eval, buf);
}

return TRUE;
}

Expand Down
5 changes: 0 additions & 5 deletions lib/logmpx.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ log_multiplexer_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_op
* write protected so that changes in those branches don't overwrite
* data we still need */

msg_trace("logmpx: making message readonly",
evt_tag_int("next_hops", self->next_hops->len),
evt_tag_int("pipe_next", !!self->super.pipe_next),
log_expr_node_location_tag(self->super.expr_node),
evt_tag_str("expr_text", self->super.expr_node && self->super.expr_node->expr_text ? self->super.expr_node->expr_text : "n/a"));
filterx_eval_prepare_for_fork(path_options->filterx_context, &msg, path_options);
log_msg_write_protect(msg);
}
Expand Down
17 changes: 1 addition & 16 deletions lib/logpipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "logpipe.h"
#include "cfg-tree.h"
#include "cfg-walker.h"
#include "perf/perf.h"

gboolean (*pipe_single_step_hook)(LogPipe *pipe, LogMessage *msg, const LogPathOptions *path_options);

Expand Down Expand Up @@ -147,20 +146,6 @@ log_pipe_clone_method(LogPipe *dst, const LogPipe *src)
log_pipe_set_options(dst, &src->options);
}

static gboolean
log_pipe_post_config_init_method(LogPipe *self)
{
// GlobalConfig *cfg = log_pipe_get_config(self);
if (self->flags & PIF_CONFIG_RELATED)
{
gchar buf[256];
/* FIXME: check that perf profiling is enabled */
if (!perf_is_trampoline_address(self->queue))
self->queue = perf_generate_trampoline(self->queue, log_expr_node_format_location(self->expr_node, buf, sizeof(buf)));
}
return TRUE;
}

void
log_pipe_init_instance(LogPipe *self, GlobalConfig *cfg)
{
Expand All @@ -169,7 +154,7 @@ log_pipe_init_instance(LogPipe *self, GlobalConfig *cfg)
self->pipe_next = NULL;
self->persist_name = NULL;
self->plugin_name = NULL;
self->post_config_init = log_pipe_post_config_init_method;

self->queue = log_pipe_forward_msg;
self->free_fn = log_pipe_free_method;
self->arcs = _arcs;
Expand Down

0 comments on commit d54d015

Please sign in to comment.