MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / prom_push_stat

Function prom_push_stat

modules/prometheus/prometheus.c:597–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597static inline int prom_push_stat(stat_var *stat, str *page, int max_len,
598 struct list_head *groups, struct list_head *label_groups)
599{
600 int s, skip_type = 0;
601 group_stats *grp = NULL;
602
603 /* first, check if the stat is part of a stats group */
604 if ((stat->flags & STAT_HAS_GROUP) && (grp = get_stat_group(stat)) != NULL) {
605 /* if the group was already dumped, we don't need to do anything
606 * since the variable has already been printed */
607 if (prom_groups_exists(groups, grp))
608 return 0;
609 /* print all stats in the group - the first one prints the type */
610 for (s = 0; s < grp->no; s++)
611 if (prom_print_stat(grp->vars[s],
612 &grp->name, NULL, page, max_len, &skip_type) < 0)
613 return -1;
614 prom_groups_add(groups, grp); /* add the group, to make sure
615 vars are not double printed */
616 return 0;
617 } else if (prom_push_stat_labels(stat, label_groups) < 0) {
618 return prom_print_stat(stat, &stat->name, NULL, page, max_len, 0);
619 } else {
620 return 0;
621 }
622}
623
624#define PROM_PUSH_STAT(_s, _m) \
625 do { \

Callers

nothing calls this directly

Calls 5

get_stat_groupFunction · 0.85
prom_groups_existsFunction · 0.85
prom_print_statFunction · 0.85
prom_groups_addFunction · 0.85
prom_push_stat_labelsFunction · 0.85

Tested by

no test coverage detected