PMIPUTLABEL(3)

✨ PMIPUTLABEL ✨

okay bestie, welcome to pmiPutLabel πŸ’– β€” that's section 3 of the Library Functions Manual, and she is lowkey the moment you get to label everything in your output archive. let's get into it 🫢


🌸 NAME 🌸

pmiPutLabel β€” add labels to the output archive. yes, literally just that. she labels. she's iconic. πŸ’…


πŸŽ€ C SYNOPSIS πŸŽ€

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

int pmiPutLabel(unsigned int type, unsigned int id,
                unsigned int instance, const char *name,
                const char *value);

cc ... -lpcp_import -lpcp

πŸ¦‹ Perl SYNOPSIS πŸ¦‹

use PCP::LogImport;

pmiPutLabel($type, $id, $instance, $name, $value);

🌈 Python SYNOPSIS 🌈

from pcp import pmi

log.pmiPutLabel(type, id, instance, name, value)

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜• β€” as part of the Performance Co-Pilot Log Import API (peep LOGIMPORT(3) for the whole lore), pmiPutLabel adds a label for the global context, or for a given domain, cluster, item, instance domain or instance. it's giving "tag everything so future you knows what's what" 🏷️✨

the type has to be one of these, no substitutions bestie:

  • PM_LABEL_CONTEXT
  • PM_LABEL_DOMAIN
  • PM_LABEL_CLUSTER
  • PM_LABEL_ITEM
  • PM_LABEL_INDOM
  • PM_LABEL_INSTANCES

if type is PM_LABEL_CONTEXT, then id and instance are just... not it, they're ignored πŸ™ˆ. otherwise, id should match a domain, cluster, metric or instance domain that you defined earlier in a call to pmiAddMetric(3).

if type is PM_LABEL_INSTANCES, then instance should match an instance number of the selected domain. otherwise instance gets ignored, she's not needed πŸ’…

name is a string holding the name of the label you're adding.

value is a string holding the value of that label.

important: no data gets written until you call pmiWrite(3)!! so the move is calling pmiPutLabel a bunch of times to stack up several labels, and then calling pmiWrite(3). accumulate first, write later, that's the whole vibe ✨

πŸ‘‘ DIAGNOSTICS πŸ‘‘

pmiPutLabel returns zero on success β€” slay πŸŽ‰ β€” otherwise it returns a negative value, which you can turn into an actual error message by calling pmiErrStr(3). not me getting a negative return and needing emotional support 😭


🌟 SEE ALSO 🌟


and that's the whole page, bestie πŸŽ€ mwah πŸ’‹ this one came to you courtesy of Performance Co-Pilot and the PMIPUTLABEL(3) energy β€” go forth and label responsibly πŸ‘‘πŸ’–

πŸ“¦ where this page comes from