1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

stats: properly handle invalid metric and type names

This commit is contained in:
Steffen Vogel 2019-02-17 22:23:15 +01:00
parent c27bd6c03f
commit 1c6780be23
2 changed files with 4 additions and 2 deletions

View file

@ -44,6 +44,7 @@ enum stats_format {
};
enum stats_metric {
STATS_METRIC_INVALID = -1,
STATS_METRIC_SKIPPED, /**< Counter for skipped samples due to hooks. */
STATS_METRIC_REORDERED, /**< Counter for reordered samples. */
STATS_METRIC_GAP_SAMPLE, /**< Histogram for inter sample timestamps (as sent by remote). */
@ -53,6 +54,7 @@ enum stats_metric {
};
enum stats_type {
STATS_TYPE_INVALID = -1,
STATS_TYPE_LAST,
STATS_TYPE_HIGHEST,
STATS_TYPE_LOWEST,

View file

@ -70,7 +70,7 @@ enum stats_metric stats_lookup_metric(const char *str)
return d->metric;
}
return -1;
return STATS_METRIC_INVALID;
}
enum stats_type stats_lookup_type(const char *str)
@ -82,7 +82,7 @@ enum stats_type stats_lookup_type(const char *str)
return d->type;
}
return -1;
return STATS_TYPE_INVALID;
}
int stats_init(struct stats *s, int buckets, int warmup)