#include "event-exporter.h"
#include "stats-settings.h"
#include "stats-metrics.h"
+#include "settings-parser.h"
#include <ctype.h>
}
}
+bool stats_metrics_add_dynamic(struct stats_metrics *metrics,
+ struct stats_metric_settings *set,
+ const char **error_r)
+{
+ if (!stats_metric_setting_parser_info.check_func(set, metrics->pool, error_r))
+ return FALSE;
+ stats_metrics_add_set(metrics, set);
+ return TRUE;
+}
+
+bool stats_metrics_remove_dynamic(struct stats_metrics *metrics,
+ const char *name)
+{
+ struct metric *m;
+ array_foreach_elem(&metrics->metrics, m) {
+ if (strcmp(m->name, name) == 0)
+ return event_filter_remove_queries_with_context(metrics->filter, m);
+ }
+ return FALSE;
+}
+
static void
stats_metrics_add_from_settings(struct stats_metrics *metrics,
const struct stats_settings *set)
#define STATS_EVENT_FIELD_NAME_DURATION "duration"
struct metric;
+struct stats_metrics;
struct exporter {
const char *name;
struct metric_export_info export_info;
};
+bool stats_metrics_add_dynamic(struct stats_metrics *metrics,
+ struct stats_metric_settings *set,
+ const char **error_r);
+
+bool stats_metrics_remove_dynamic(struct stats_metrics *metrics,
+ const char *name);
+
struct stats_metrics *stats_metrics_init(const struct stats_settings *set);
void stats_metrics_deinit(struct stats_metrics **metrics);