output-stats: remove ThreadExitPrintStats callback

Not used.

Ticket: #7227
pull/11689/head
Jason Ish 12 months ago committed by Victor Julien
parent 07d4d08665
commit d88d8fc4f0

@ -284,7 +284,6 @@ static void LogStatsLogDeInitCtx(OutputCtx *output_ctx)
void LogStatsLogRegister (void) void LogStatsLogRegister (void)
{ {
OutputRegisterStatsModule(LOGGER_STATS, MODULE_NAME, "stats", OutputRegisterStatsModule(LOGGER_STATS, MODULE_NAME, "stats", LogStatsLogInitCtx,
LogStatsLogInitCtx, LogStatsLogger, LogStatsLogThreadInit, LogStatsLogger, LogStatsLogThreadInit, LogStatsLogThreadDeinit);
LogStatsLogThreadDeinit, NULL);
} }

@ -500,9 +500,9 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_
void JsonStatsLogRegister(void) { void JsonStatsLogRegister(void) {
/* register as child of eve-log */ /* register as child of eve-log */
OutputRegisterStatsSubModule(LOGGER_JSON_STATS, "eve-log", MODULE_NAME, OutputRegisterStatsSubModule(LOGGER_JSON_STATS, "eve-log", MODULE_NAME, "eve-log.stats",
"eve-log.stats", OutputStatsLogInitSub, JsonStatsLogger, OutputStatsLogInitSub, JsonStatsLogger, JsonStatsLogThreadInit,
JsonStatsLogThreadInit, JsonStatsLogThreadDeinit, NULL); JsonStatsLogThreadDeinit);
} }
#ifdef UNITTESTS #ifdef UNITTESTS

@ -44,15 +44,12 @@ typedef struct OutputStatsLogger_ {
const char *name; const char *name;
ThreadInitFunc ThreadInit; ThreadInitFunc ThreadInit;
ThreadDeinitFunc ThreadDeinit; ThreadDeinitFunc ThreadDeinit;
ThreadExitPrintStatsFunc ThreadExitPrintStats;
} OutputStatsLogger; } OutputStatsLogger;
static OutputStatsLogger *list = NULL; static OutputStatsLogger *list = NULL;
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *output_ctx,
OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{ {
OutputStatsLogger *op = SCCalloc(1, sizeof(*op)); OutputStatsLogger *op = SCCalloc(1, sizeof(*op));
if (op == NULL) if (op == NULL)
@ -63,7 +60,6 @@ int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
op->name = name; op->name = name;
op->ThreadInit = ThreadInit; op->ThreadInit = ThreadInit;
op->ThreadDeinit = ThreadDeinit; op->ThreadDeinit = ThreadDeinit;
op->ThreadExitPrintStats = ThreadExitPrintStats;
if (list == NULL) if (list == NULL)
list = op; list = op;
@ -170,27 +166,10 @@ static TmEcode OutputStatsLogThreadDeinit(ThreadVars *tv, void *thread_data)
return TM_ECODE_OK; return TM_ECODE_OK;
} }
static void OutputStatsLogExitPrintStats(ThreadVars *tv, void *thread_data)
{
OutputStatsLoggerThreadData *op_thread_data = (OutputStatsLoggerThreadData *)thread_data;
OutputLoggerThreadStore *store = op_thread_data->store;
OutputStatsLogger *logger = list;
while (logger && store) {
if (logger->ThreadExitPrintStats) {
logger->ThreadExitPrintStats(tv, store->thread_data);
}
logger = logger->next;
store = store->next;
}
}
void TmModuleStatsLoggerRegister (void) void TmModuleStatsLoggerRegister (void)
{ {
tmm_modules[TMM_STATSLOGGER].name = "__stats_logger__"; tmm_modules[TMM_STATSLOGGER].name = "__stats_logger__";
tmm_modules[TMM_STATSLOGGER].ThreadInit = OutputStatsLogThreadInit; tmm_modules[TMM_STATSLOGGER].ThreadInit = OutputStatsLogThreadInit;
tmm_modules[TMM_STATSLOGGER].ThreadExitPrintStats = OutputStatsLogExitPrintStats;
tmm_modules[TMM_STATSLOGGER].ThreadDeinit = OutputStatsLogThreadDeinit; tmm_modules[TMM_STATSLOGGER].ThreadDeinit = OutputStatsLogThreadDeinit;
tmm_modules[TMM_STATSLOGGER].cap_flags = 0; tmm_modules[TMM_STATSLOGGER].cap_flags = 0;
} }

@ -49,9 +49,8 @@ TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st);
typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *); typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *);
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *,
OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
ThreadExitPrintStatsFunc ThreadExitPrintStats);
void TmModuleStatsLoggerRegister (void); void TmModuleStatsLoggerRegister (void);

@ -539,10 +539,9 @@ error:
* *
* \retval Returns 0 on success, -1 on failure. * \retval Returns 0 on success, -1 on failure.
*/ */
void OutputRegisterStatsModule(LoggerId id, const char *name, void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name,
const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadDeinitFunc ThreadDeinit)
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{ {
if (unlikely(StatsLogFunc == NULL)) { if (unlikely(StatsLogFunc == NULL)) {
goto error; goto error;
@ -560,7 +559,6 @@ void OutputRegisterStatsModule(LoggerId id, const char *name,
module->StatsLogFunc = StatsLogFunc; module->StatsLogFunc = StatsLogFunc;
module->ThreadInit = ThreadInit; module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit; module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries); TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Stats logger \"%s\" registered.", name); SCLogDebug("Stats logger \"%s\" registered.", name);
@ -577,11 +575,9 @@ error:
* *
* \retval Returns 0 on success, -1 on failure. * \retval Returns 0 on success, -1 on failure.
*/ */
void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name,
const char *name, const char *conf_name, OutputInitSubFunc InitFunc, const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc,
StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats)
{ {
if (unlikely(StatsLogFunc == NULL)) { if (unlikely(StatsLogFunc == NULL)) {
goto error; goto error;
@ -600,7 +596,6 @@ void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
module->StatsLogFunc = StatsLogFunc; module->StatsLogFunc = StatsLogFunc;
module->ThreadInit = ThreadInit; module->ThreadInit = ThreadInit;
module->ThreadDeinit = ThreadDeinit; module->ThreadDeinit = ThreadDeinit;
module->ThreadExitPrintStats = ThreadExitPrintStats;
TAILQ_INSERT_TAIL(&output_modules, module, entries); TAILQ_INSERT_TAIL(&output_modules, module, entries);
SCLogDebug("Stats logger \"%s\" registered.", name); SCLogDebug("Stats logger \"%s\" registered.", name);

@ -133,17 +133,12 @@ void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *co
enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit, enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit); ThreadDeinitFunc ThreadDeinit);
void OutputRegisterStatsModule(LoggerId id, const char *name, void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name,
const char *conf_name, OutputInitFunc InitFunc, OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
ThreadDeinitFunc ThreadDeinit, void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name,
ThreadExitPrintStatsFunc ThreadExitPrintStats); const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc,
void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
const char *name, const char *conf_name,
OutputInitSubFunc InitFunc,
StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
ThreadDeinitFunc ThreadDeinit,
ThreadExitPrintStatsFunc ThreadExitPrintStats);
OutputModule *OutputGetModuleByConfName(const char *name); OutputModule *OutputGetModuleByConfName(const char *name);
void OutputDeregisterAll(void); void OutputDeregisterAll(void);

@ -606,9 +606,8 @@ static void SetupOutput(
} }
/* stats logger doesn't run in the packet path */ /* stats logger doesn't run in the packet path */
if (module->StatsLogFunc) { if (module->StatsLogFunc) {
OutputRegisterStatsLogger(module->name, module->StatsLogFunc, OutputRegisterStatsLogger(module->name, module->StatsLogFunc, output_ctx,
output_ctx,module->ThreadInit, module->ThreadDeinit, module->ThreadInit, module->ThreadDeinit);
module->ThreadExitPrintStats);
return; return;
} }

Loading…
Cancel
Save