Source
static int prometheus_aggregate_values(const zbx_vector_ptr_t *rows, const char *function, char **value, char **error)
/*
** Zabbix
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/* Defines maximum row length to be written in error message in the case of parsing failure */
typedef enum
{
ZBX_PROMETHEUS_CONDITION_OP_EQUAL,
ZBX_PROMETHEUS_CONDITION_OP_REGEX,
ZBX_PROMETHEUS_CONDITION_OP_EQUAL_VALUE,
ZBX_PROMETHEUS_CONDITION_OP_NOT_EQUAL,
ZBX_PROMETHEUS_CONDITION_OP_REGEX_NOT_MATCHED
}
zbx_prometheus_condition_op_t;
/* key-value matching data */
typedef struct
{
/* the key to match, optional - can be NULL */
char *key;
/* the pattern to match */
char *pattern;
/* the condition operations */
zbx_prometheus_condition_op_t op;
}
zbx_prometheus_condition_t;
/* the prometheus pattern filter */
typedef struct
{
/* metric filter, optional - can be NULL */