mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 10:11:53 +00:00
d648c6b602
Add new global counter for stats channel New symbol is added for each stats protocol channel, the symbol is accessed by same name as the underlying channel. Symbols evaluate to the sum of all routes exported from connected table with generation less than max generation of particular channel. Default max generation is 16. Beware you shouldn't make cyclic references as the behavior of such configuration is not defined!
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/*
|
|
* BIRD -- Statistics Protocol
|
|
*
|
|
* (c) 2022 Vojtech Vilimek <vojtech.vilimek@nic.cz>
|
|
* (c) 2022 CZ.NIC z.s.p.o.
|
|
*
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
*/
|
|
|
|
#ifndef _BIRD_STATS_H_
|
|
#define _BIRD_STATS_H_
|
|
#include "lib/timer.h"
|
|
#include "filter/data.h"
|
|
|
|
struct stats_channel;
|
|
|
|
struct stats_term_config {
|
|
node n;
|
|
const struct f_line *code;
|
|
struct f_val *val;
|
|
int type; /* type declared in configuration */
|
|
const char *name;
|
|
};
|
|
|
|
struct stats_config {
|
|
struct proto_config c;
|
|
list terms; /* list of counter terms */
|
|
};
|
|
|
|
struct stats_proto {
|
|
struct proto p;
|
|
struct stats_channel *c;
|
|
struct tbf rl_gen;
|
|
};
|
|
|
|
struct stats_channel {
|
|
struct channel c;
|
|
pool *pool; /* copy of procotol pool */
|
|
u32 _counter; /* internal counter */
|
|
u32 counter; /* publicly accessible counter */
|
|
struct settle_timer settle_timer;
|
|
};
|
|
|
|
struct stats_channel_config {
|
|
struct channel_config c;
|
|
btime min_settle_time; /* wait before notifying filters */
|
|
btime max_settle_time;
|
|
};
|
|
|
|
int stats_get_counter(struct symbol *sym);
|
|
void stats_eval_term(struct stats_term_config *tc);
|
|
|
|
#endif
|