PMSERIESSETUP(3)
π PMSERIESSETUP(3) β Library Functions Manual π
okay bestie, so this is a page from the Library Functions Manual, and it's giving main character energy for the whole time series subsystem. sit down, grab a boba, we're doing this. π§
β¨ NAME β¨
pmSeriesSetup, pmSeriesSetSlots, pmSeriesSetEventLoop, pmSeriesSetConfiguration, pmSeriesSetMetricRegistry, pmSeriesClose β fast, scalable time series services π¦
πΈ C SYNOPSIS πΈ
#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
π DESCRIPTION π
so pmSeriesSetup and its lil friend group of API functions are here to prep your application for accessing the fast, scalable time series querying functionality of the Performance Co-Pilot (PCP). iconic behaviour, honestly.
this whole thing is served through asynchronous APIs, which function in an event-driven fashion β no blocking, no waiting around, we're busy girls π . the interfaces described right here prepare a given time series module, and that module is what associates callback routines with certain asynchronous events that happen while servicing time series requests.
as a general pattern (iykyk), every interface in these APIs that needs to invoke callbacks provided by the calling program will take an opaque (void * pointer) parameter, arg. that pointer gets passed through unchanged, and it's typically used to access a data structure that maintains state within the calling program. she's a courier, she doesn't peek at the mail. π¬
where async setup is required by pmSeriesSetup, its completion will be indicated through the on_setup callback β which is part of the pmSeriesModule structure you passed in. that same structure also handles custom diagnostics, via the on_info callback. these are self-explanatory fr fr, so peek at <pcp/pmwebapi.h> for the exact calling conventions. π
the callbacks registered by pmSeriesSetup to handle events are as follows β buckle up, it's a whole roster:
pmSeriesMatchCallBack on_matchβ when a time series query discovers time series identifiers that match the query, theon_matchcallback gets called once for every series identifier (SID). the SID is a unique 40-byte ASCII representation of a SHA hash. yes, forty. not thirty-nine, not forty-one. πpmSeriesDescCallBack on_descβ metric descriptor requests coming frompmSeriesDescs(1)will invoke this callback once for each series identifier.pmSeriesInstCallBack on_instβ the instance identification callback π« internal (numeric) and external (string) instance identifiers, plus time series and source (host) SHA1 identifiers. called once for each instance. the associated series identifier is also handed to the callback.pmSeriesLabelCallBack on_labelmapβ provides metric labels (name and value mappings) for each series identifier passed topmSeriesLabels(1).pmSeriesStringCallBack on_instanceβ provides an instance name for a call topmSeriesInstances(1)β the callback is called once for each instance name. the associated series identifier is also provided to the callback. πpmSeriesStringCallBack on_contextβ provides a context name for a call topmSeriesSources(1)β the callback is called once for each source (hostname or archive). the associated source identifier is also provided to the callback. πpmSeriesStringCallBack on_metricβ provides a metric name for a call topmSeriesMetrics(1)β the callback is called once for each metric name. the associated series identifier is also provided to the callback. βpmSeriesStringCallBack on_labelβ provides a label name for a call topmSeriesLabels(1)β the callback is called once for each label name. the associated series identifier is also provided to the callback. πpmSeriesValueCallBack on_valueβ calls to thepmSeriesQueryinterface that provide a time window may result in values being found for matching time series. theon_valuecallback will be invoked once for each time series value, also providing the sample timestamp (in both string and binary form, as a time in nanoseconds since the epoch). the associated series identifier is also provided to the callback. π₯pmSeriesDoneCallBack on_doneβ on completion of all asynchronous interfaces that return success (zero return code), this callback will be called. it provides a status code indicating overall success (zero) or failure (negative PMAPI code) of the operation. the finale, the moment we've all been waiting for. π«Ά
the helper functions β pmSeriesSetSlots (key-value server), pmSeriesSetEventLoop (libuv), pmSeriesSetConfiguration (configuration file) and pmSeriesSetMetricRegistry (MMV instrumentation) β are the interfaces that give you a mechanism for passing in state for each of the associated subsystems. one lil state drop per subsystem, no cap. π§
finally, a call to pmSeriesClose is what ends the services available from a series module that was previously established through pmSeriesSetup. closing time, you don't gotta go home but you can't stay here. π
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. they're the ones actually eating at this table. π
π DIAGNOSTICS π
where these functions return a status code, it's always zero on success. on failure you get a negative PMAPI error code back. so like... check your return values, bestie. every single time. no skipping. π
π SEE ALSO π
pmproxy(1), pmlogger(1), pmseries(1), mmv_stats_registry(3), pmSeriesDescs(3), pmSeriesQuery(3), PMAPI(3) and PMWEBAPI(3).
go read them. all of them. I'm not kidding, the cross-references are the lore. π
and that's the page!! π brought to you by Performance Co-Pilot / PCP β this manual page is literally titled PMSERIESSETUP(3), and it slayed. mwah, bye bestie πβ¨π
π¦ where this page comes from
- arch rolling: pcp 7.2.2-2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later AND CC-BY-3.0
- centos-stream 10: pcp-doc 7.1.5-6.el10 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.0.1-1.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 43: pcp-doc 7.2.1-1.fc43
- fedora 43: pcp-doc 7.2.2-1.fc43
- fedora 43: pcp-doc 7.2.2-2.fc43 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.1.0-6.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- fedora 44: pcp-doc 7.2.1-1.fc44
- fedora 44: pcp-doc 7.2.2-1.fc44
- fedora 44: pcp-doc 7.2.2-2.fc44 Β· GPL-2.0-or-later AND CC-BY-3.0
- ubuntu resolute: libpcp4-dev 7.1.1-1
- ubuntu stonking: libpcp4-dev 7.2.1-2build1
- Copyright (c) 2019 Red Hat
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms