29 #define MAX_STAT_SAMPLES 128
30 #define MAX_SAMPLE_SIZE 64
36 log(LOG_MYSQL,
"Error inserting stats %d.%u into DB",
51 log(LOG_PROCESS_STATS,
"Error getting stat sample %d.%u",
57 log_error(
"Error appending stats %d.%u to timeseries",
67 if (incoming_samples == NULL) {
68 log_error(
"Stat msg handler not initialized");
75 log_error(
"Error deserializing stat samples");
79 for (
int i=0; i<n_samples; i++) {
95 if (incoming_samples == NULL) {
96 log_error(
"Error initializing stat samples");
Round-robin database (circular buffer) for storing timeseries data.
struct timed_stat * stats
The statistics in question.
static int process_stat_sample(int runtime_id, struct stat_sample *sample)
int handle_serialized_stats_buffer(int runtime_id, void *buffer, size_t buffer_len)
A single stat sample for a single item.
struct stat_sample * init_stat_samples(int max_stats, int n_samples)
Initilizes n sets of samples of statistics, each of which contains max_stats points.
int deserialize_stat_samples(void *buffer, size_t buff_len, struct stat_sample *samples, int n_samples)
Deserializes from the provided buffer into the samples structure.
int init_stats_msg_handler()
Logging of status messages to the terminal.
struct timed_rrdb * get_msu_stat(enum stat_id id, unsigned int msu_id)
int n_stats
The size of the sample (number of stats, not number of items)
enum stat_id stat_id
The ID of the statistic being sampled.
int append_to_timeseries(struct timed_stat *input, int input_size, struct timed_rrdb *timeseries)
Appends a number of timed statistics to a timeseries.
#define log_error(fmt,...)
int fix_all_route_ranges(struct dedos_dfg *dfg)
unsigned int item_id
The ID for the item being sampled.
struct stat_sample * incoming_samples
static int runtime_id(int runtime_fd)
#define log(level, fmt,...)
Log at a custom level.
struct dedos_dfg * get_dfg()
int is_msu_stat(enum stat_id id)
struct timed_rrdb * get_thread_stat(enum stat_id id, unsigned int runtime_id, unsigned int thread_id)
struct stat_sample_hdr hdr
int is_thread_stat(enum stat_id id)
int db_insert_sample(struct timed_stat *input, struct stat_sample_hdr *input_hdr, int runtime_id)
Insert datapoint for a timseries in the DB.