Source
static int prometheus_query_rows(const zbx_vector_prometheus_row_t *rows, const char *request, const char *output,
/*
** 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 Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
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;
ZBX_PTR_VECTOR_DECL(prometheus_condition, zbx_prometheus_condition_t *)
/* the prometheus pattern filter */
typedef struct
{
/* metric filter, optional - can be NULL */
zbx_prometheus_condition_t *metric;
/* value filter, optional - can be NULL */
zbx_prometheus_condition_t *value;
/* label filters */
zbx_vector_prometheus_condition_t labels;
}
zbx_prometheus_filter_t;