diff options
| author | fumingwei <[email protected]> | 2023-03-10 16:12:37 +0800 |
|---|---|---|
| committer | fumingwei <[email protected]> | 2023-03-10 18:49:51 +0800 |
| commit | 2816c069d7a52c92abde4eb9c564950c64c94044 (patch) | |
| tree | 336a92ce24aadcefa8e296ca55e4ff49ed0eb641 /inc | |
| parent | b2daf45366e59ac3f7b44b3e465224b4c3c5a82e (diff) | |
feature:修改table结构体
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/fieldstat.h | 74 |
1 files changed, 61 insertions, 13 deletions
diff --git a/inc/fieldstat.h b/inc/fieldstat.h index c58e798..af28345 100644 --- a/inc/fieldstat.h +++ b/inc/fieldstat.h @@ -76,7 +76,7 @@ int fieldstat_background_thead_disable(struct fieldstat_instance *instance); int fieldstat_set_output_interval(struct fieldstat_instance *instance, int seconds); /** * Register counter and gauge type metrics - * @param field_name the name of the field + * @param instance The fieldstat instance. * @param type Counter, gauge. * @param field_name Metric field name. * @param tag_key Tag key array @@ -86,30 +86,78 @@ int fieldstat_set_output_interval(struct fieldstat_instance *instance, int secon */ int fieldstat_register(struct fieldstat_instance *instance, enum field_type type, const char *field_name, const char *tag_key[], const char *tag_value[], size_t n_tag); /** - * Register counter and gauge type metrics - * @param field_name the name of the field - * @param type Counter, gauge. - * @param field_name Metric field name. + * Register table. Max table num is 64. Max table columns is 64. + * @param instance The fieldstat instance. + * @param name The table name. + * @param column_name column name array. + * @param column_type column type array. Type in [counter, gauge] + * @param n_column size of column_type[] and column_name[] + * @return -1 is failed. 0 is success. + */ +int fieldstat_register_table(struct fieldstat_instance *instance, const char *name, const char *column_name[], enum field_type column_type[], size_t n_column); +/** + * Register table metric + * @param instance The fieldstat instance. + * @param table_id The table id by fieldstat_register_table create. + * @param line_name The table line name. * @param tag_key Tag key array * @param tag_value Tag key array * @param n_tag size of tag_key[] and tag_value[] * @return -1 is failed. 0 is success. */ -int fieldstat_register_table(struct fieldstat_instance *instance, enum field_type table_type[], const char *field_list[], size_t n_field); -//int fieldstat_register_table_metrics(struct fieldstat_instance * instance, const char *field_name, const char *tag_key[], const char *tag_value[]); -struct metric_id_list fieldstat_register_table_metrics(struct fieldstat_instance * instance, int table_id, const char *field_name, const char *tag_key[], const char *tag_value[],size_t n_tag); - - +struct metric_id_list fieldstat_register_table_metrics(struct fieldstat_instance * instance, int table_id, const char *line_name, const char *tag_key[], const char *tag_value[],size_t n_tag); +/** + * increment filed value. + * @param instance The fieldstat instance. + * @param field_id The field id. + * @param increment the value to increment + * @return -1 is failed. 0 is success. + */ int fieldstat_value_incrby(struct fieldstat_instance *instance, int field_id, long long increment); +/** + * Set filed value. + * @param instance The fieldstat instance. + * @param field_id The field id. + * @param increment the value to set + * @return -1 is failed. 0 is success. + */ int fieldstat_value_set(struct fieldstat_instance *instance, int field_id, long long retain); +/** + * Decrment filed value. + * @param instance The fieldstat instance. + * @param field_id The field id. + * @param increment the value to decrment + * @return -1 is failed. 0 is success. + */ int fieldstat_value_decrby(struct fieldstat_instance *instance, int field_id, long long decrment); - +/** + * Make the fieldstat instance affect. + * @param instance The fieldstat instance. + */ void fieldstat_instance_start(struct fieldstat_instance *instance); +/** + * passive output + * @param instance The fieldstat instance. + */ void fieldstat_passive_output(struct fieldstat_instance *instance); /** + * Register histogram metric + * @param instance fieldstat instance + * @param field_name field name + * @param tag_key the array of tag key + * @param tag_value the array of tag value + * @param n_tag the number of tags + * @param quantiles the quantiles of summary output + * @return metric id: -1 is failed, > 0 is success + * the output. + */ +int fieldstat_register_histogram(struct fieldstat_instance *instance, const char *field_name, const char *tag_key[], const char *tag_value[], size_t n_tag, + const char * bins,const long long lowest_trackable_value,long long highest_trackable_value,int significant_figures); + +/** + * Register summary metric * @param instance fieldstat instance - * @param type field type * @param field_name field name * @param tag_key the array of tag key * @param tag_value the array of tag value @@ -118,7 +166,7 @@ void fieldstat_passive_output(struct fieldstat_instance *instance); * @return metric id: -1 is failed, > 0 is success * the output. */ -int fieldstat_register_histogram(struct fieldstat_instance *instance, enum field_type type, const char *field_name, const char *tag_key[], const char *tag_value[], size_t n_tag, +int fieldstat_register_summary(struct fieldstat_instance *instance, const char *field_name, const char *tag_key[], const char *tag_value[], size_t n_tag, const char * bins,const long long lowest_trackable_value,long long highest_trackable_value,int significant_figures); #ifdef __cplusplus |
