nmsg 1.3.0
Functions
statsmod.h File Reference

Loading and calling external statistics modules. More...

Go to the source code of this file.

Functions

nmsg_statsmod_t nmsg_statsmod_init (const char *name, const void *param, const size_t len_param)
 Initialize a statistics module with the given parameters.
 
void nmsg_statsmod_destroy (nmsg_statsmod_t *statsmod)
 Destroy a statistics module.
 
nmsg_res nmsg_statsmod_add_io (nmsg_statsmod_t statsmod, nmsg_io_t io, const char *name)
 Add an nmsg_io_t object to the statsmod instrumentation.
 
nmsg_res nmsg_statsmod_remove_io (nmsg_statsmod_t statsmod, nmsg_io_t io)
 Remove an nmsg_io_t object from statsmod instrumentation.
 

Detailed Description

Loading and calling external statistics modules.

This file defines the interface for loading and calling statistics modules. For the interface that developers of message filter modules must implement, see nmsg/statsmod_plugin.h.

Statistics modules allow statistics from an nmsg_io_t to be exported to an external metrics gathering system.

Definition in file statsmod.h.

Function Documentation

◆ nmsg_statsmod_init()

nmsg_statsmod_t nmsg_statsmod_init ( const char *  name,
const void *  param,
const size_t  len_param 
)

Initialize a statistics module with the given parameters.

Calls the module's 'module_init' function.

Parameters
nameThe name of the statistics module, which is used to construct the filesystem path to the shared object containing the module. This may either be a real, complete filesystem path (absolute or relative) that begins with "/" or "./", or it may be a short "convenience" name that will be expanded to a real filesystem path. For example, the short name "sample" might be expanded to a long name like "/usr/lib/nmsg/nmsg_stats1_sample.so".
paramPointer to a value that will be passed to the 'module_init' function. Specifies module-specific configuration.
len_paramLength of the 'param' value. Passed to the 'module_init' function.
Returns
Opaque pointer that is NULL on failure or non-NULL on success.

◆ nmsg_statsmod_destroy()

void nmsg_statsmod_destroy ( nmsg_statsmod_t *  statsmod)

Destroy a statistics module.

Calls the module's 'module_fini' function.

Parameters
[in]statsmodInitialized statsmod.

◆ nmsg_statsmod_add_io()

nmsg_res nmsg_statsmod_add_io ( nmsg_statsmod_t  statsmod,
nmsg_io_t  io,
const char *  name 
)

Add an nmsg_io_t object to the statsmod instrumentation.

Parameters
statsmodThe stats module returned from nmsg_statsmod_init().
ioThe nmsg_io_t object to instrument.
nameA unique name to use when publishing stats for this io.

◆ nmsg_statsmod_remove_io()

nmsg_res nmsg_statsmod_remove_io ( nmsg_statsmod_t  statsmod,
nmsg_io_t  io 
)

Remove an nmsg_io_t object from statsmod instrumentation.

Either nmsg_statsmod_remove_io(io) or nmsg_statsmod_destroy(mod) must be called before nmsg_io_destroy(io).

Parameters
statsmodThe stats module returned from nmsg_statsmod_init().
ioThe nmsg_io_t object to remove.