PMIADDINSTANCE(3)

πŸ’– pmiAddInstance(3) πŸ’–

okay bestie, welcome to the Library Functions Manual corner of the PCP universe β€” this one is pmiAddInstance, and it's literally the glow-up step where a new instance gets added to an instance domain inside a LOGIMPORT context. iconic behaviour, honestly. πŸ¦‹


✨ NAME ✨

pmiAddInstance β€” add an element to an instance domain in a LOGIMPORT context. periodt. πŸ‘‘


🐚 C SYNOPSIS

#include <pcp/pmapi.h>
#include <pcp/import.h>

int pmiAddInstance(pmInDom indom, const char *instance, int inst);

cc ... -lpcp_import -lpcp

🌸 Perl SYNOPSIS

use PCP::LogImport;

pmiAddInstance($indom, $instance, $inst);

🐍 Python SYNOPSIS

from pcp import pmi

log.pmiAddInstance(indom, instance, instid)

πŸ’… DESCRIPTION πŸ’…

so, plot twist, this is all part of the Performance Co-Pilot Log Import API (peep LOGIMPORT(3) for the lore, iykyk). What pmiAddInstance does is add a brand-new element to the instance domain that's identified by indom. slay. ✨

now, indom would normally be built using the pmInDom_build macro β€” like pmInDom_build(PMI_DOMAIN,0) for the first instance domain in the Performance Metrics Domain PMI_DOMAIN, which is lowkey the default for all meta data that the LOGIMPORT library creates. πŸ’œ

the new instance has to come with both of these, no exceptions bestie:

  • an external name β€” that's instance
  • an internal instance identifier β€” that's inst

and inst has to be unique across all the instances in the indom instance domain. 🫢

⚠️ there's a special "uniqueness rule" for instance that pmLookupInDom(3) imposes on you, and it's giving strict-parent energy: the external instance name must be unique in the leading non-space characters. so for example, the instance names foo and foo bar get considered the same by this rule and are not allowed in the same instance domain β€” but foo and foobar? those would be allowed. πŸ’€

once it's defined, that external instance name can be used in calls to pmiGetHandle(3) and/or pmiPutValue(3) alongside the name of a metric that's defined over the same instance domain. main character energy fr fr. 🌈


😭 DIAGNOSTICS 😭

pmiAddInstance returns zero on success, and otherwise a negative value β€” which you can turn into an actual error message by calling pmiErrStr(3). so if things go sideways, that's your girl. πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

LOGIMPORT(3), pmiAddMetric(3), pmiErrStr(3), pmiGetHandle(3), pmiPutValue(3), pmiPutText(3), pmiPutLabel(3) and pmLookupInDom(3). go read them, bestie, they're all part of the same friend group. 🧚


and that's a wrap!! πŸ’– this whole thing comes to you from Performance Co-Pilot β€” yes, the PMIADDINSTANCE(3) source, no cap β€” so go forth, add your instances, stay unique in your leading non-space characters, and drink some water. mwah. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from