const gchar *name; /**< name of metric */
gchar *func_name; /**< name of consolidation function */
metric_cons_func func; /**< c consolidation function */
- double grow_factor; /**< grow factor for metric */
+ gboolean accept_unknown_symbols; /**< if true unknown symbols are registered here */
+ gdouble unknown_weight; /**< weight of unknown symbols */
+ gdouble grow_factor; /**< grow factor for metric */
GHashTable *symbols; /**< weights of symbols in metric */
GHashTable *descriptions; /**< descriptions of symbols in metric */
struct metric_action actions[METRIC_ACTION_MAX]; /**< all actions of the metric */
gdouble action_score, grow_factor;
gint action_value;
gboolean new = TRUE, have_actions = FALSE;
+ gdouble unknown_weight;
ucl_object_iter_t it = NULL;
val = ucl_object_find_key (obj, "name");
metric->subject = (gchar *)subject_name;
}
+ val = ucl_object_find_key (obj, "unknown_weight");
+ if (val && ucl_object_todouble_safe (val, &unknown_weight) &&
+ unknown_weight != 0.) {
+ metric->unknown_weight = unknown_weight;
+ metric->accept_unknown_symbols = TRUE;
+ }
+
/* Insert the resulting metric */
if (new) {
g_hash_table_insert (cfg->metrics, (void *)metric->name, metric);
cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric);
+ if (strcmp (metric->name, DEFAULT_METRIC) == 0) {
+ cfg->default_metric = metric;
+ }
}
return TRUE;