aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2020-05-08 19:10:40 +0300
committerlaforge <laforge@osmocom.org>2020-05-09 08:08:53 +0000
commitdfebf405e59abd1ce8a4ee755908079bacb2cd4a (patch)
tree232fcb56bb0e2d7216cb03a888b72019cc9382e4 /include
parentf203ed3add7efc917758b081758c61fef2fdb4b7 (diff)
stats: Support regular stats flush
Reliable monitoring requires regular flush of all stat values, even if they have not changed. Otherwise (1) the monitoring app has to maintain state and (2) can go out of sync if it's restarted while the app is still running. Change-Id: I04f1e7bdf0d6f20e4f15571e94191de61c47ddad
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/core/stats.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/osmocom/core/stats.h b/include/osmocom/core/stats.h
index e01016d4..b9edac2a 100644
--- a/include/osmocom/core/stats.h
+++ b/include/osmocom/core/stats.h
@@ -73,6 +73,7 @@ struct osmo_stats_reporter {
char *bind_addr_str; /*!< local bind IP address */
int dest_port; /*!< destination (UDP) port */
int mtu; /*!< Maximum Transmission Unit */
+ unsigned int flush_period; /*!< period between regular flushes */
/*! Maximum class/index to report. FIXME: More details! */
enum osmo_stats_class max_class;
@@ -87,7 +88,8 @@ struct osmo_stats_reporter {
int fd; /*!< file descriptor of socket */
struct msgb *buffer; /*!< message buffer for log output */
int agg_enabled; /*!< is aggregation enabled? */
- int force_single_flush;
+ int force_single_flush; /*!< set to 1 to force a flush (send even unchanged stats values) */
+ unsigned int flush_period_counter; /*!< count sends between forced flushes */
struct llist_head list;
int (*open)(struct osmo_stats_reporter *srep);
@@ -129,6 +131,7 @@ int osmo_stats_reporter_set_max_class(struct osmo_stats_reporter *srep,
int osmo_stats_reporter_set_name_prefix(struct osmo_stats_reporter *srep, const char *prefix);
int osmo_stats_reporter_enable(struct osmo_stats_reporter *srep);
int osmo_stats_reporter_disable(struct osmo_stats_reporter *srep);
+int osmo_stats_reporter_set_flush_period(struct osmo_stats_reporter *srep, unsigned int period);
/* reporter creation */
struct osmo_stats_reporter *osmo_stats_reporter_create_log(const char *name);