PMSERIESSETUP(3) | Library Functions Manual | PMSERIESSETUP(3) |
pmSeriesSetup, pmSeriesSetSlots, pmSeriesSetEventLoop, pmSeriesSetConfiguration, pmSeriesSetMetricRegistry, pmSeriesClose - fast, scalable time series services
#include <pcp/pmwebapi.h>
int pmSeriesSetup(pmSeriesModule *module, pmSeriesCallBacks
*callbacks, void *arg);
int pmSeriesSetSlots(pmSeriesModule *module, void
*slots);
int pmSeriesSetEventLoop(pmSeriesModule *module, void *uvloop);
int pmSeriesSetConfiguration(pmSeriesModule *module, struct dict
*config);
int pmSeriesSetMetricRegistry(pmSeriesModule *module, struct
mmv_registry *registry);
int pmSeriesClose(pmSeriesModule *module);
cc ... -lpcp_web
The pmSeriesSetup and related API functions prepare an application for accessing the fast, scalable time series querying functionality of the Performance Co-Pilot (PCP).
This functionality is provided through asynchronous APIs, which function in an event-driven fashion. The interfaces described here prepare a given time series module which associates callback routines with certain asynchronous events that occur as part of servicing time series requests.
As a general pattern, all interfaces in these APIs that need to invoke callbacks provided by the calling program will take an opaque (void * pointer) parameter, arg. This pointer will be passed through unchanged and is typically used to access a data structure maintaining state within the calling program.
Where asynchronous setup is required by pmSeriesSetup its completion will be indicated through use of the on_setup callback, which is part of the passed in pmSeriesModule structure. This structure also provides for custom diagnostics handling, through the on_info callback. These are self-explanatory, see <pcp/pmwebapi.h> for exact calling conventions.
The callbacks registered by pmSeriesSetup to handle events are as follows:
The helper functions pmSeriesSetSlots (redis), pmSeriesSetEventLoop (libuv), pmSeriesSetConfiguration (configuration file) and pmSeriesSetMetricRegistry (MMV instrumentation) interfaces provide a mechanism for passing in state for each of the associated subsystems.
Finally, a call to pmSeriesClose is used to end services available from a series module previously established through pmSeriesSetup.
Within PCP, the pmproxy(1) and pmseries(1) utilities are the primary users of these interfaces, providing REST API and command line time series query services respectively.
Where these functions return a status code, this is always zero on success. On failure a negative PMAPI error code is returned.
pmproxy(1), pmlogger(1), pmseries(1), redis-server(1), mmv_stats_registry(3), pmSeriesDescs(3), pmSeriesQuery(3), PMAPI(3) and PMWEBAPI(3).
PCP | Performance Co-Pilot |