X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_graphite.c;h=8ae15ba0c5a2536f332b5de0358a7a13ed127d56;hb=e9fb3dcaad4d46f1e594fd773f6d2327822bdddf;hp=2ae30efe2ca179b0fd13cfafe5914f5a031b14ff;hpb=e2bdca73d28ff16ab23af1d8eec984badb1a2513;p=collectd.git diff --git a/src/write_graphite.c b/src/write_graphite.c index 2ae30efe..8ae15ba0 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -85,9 +85,7 @@ struct wg_callback char *postfix; char escape_char; - _Bool store_rates; - _Bool separate_instances; - _Bool always_append_ds; + unsigned int format_flags; char send_buf[WG_SEND_BUF_SIZE]; size_t send_buf_free; @@ -352,7 +350,7 @@ static int wg_write_messages (const data_set_t *ds, const value_list_t *vl, memset (buffer, 0, sizeof (buffer)); status = format_graphite (buffer, sizeof (buffer), ds, vl, - cb->prefix, cb->postfix, cb->escape_char, cb->store_rates); + cb->prefix, cb->postfix, cb->escape_char, cb->format_flags); if (status != 0) /* error message has been printed already. */ return (status); @@ -434,7 +432,7 @@ static int wg_config_carbon (oconfig_item_t *ci) cb->prefix = NULL; cb->postfix = NULL; cb->escape_char = WG_DEFAULT_ESCAPE; - cb->store_rates = 1; + cb->format_flags = GRAPHITE_STORE_RATES; pthread_mutex_init (&cb->send_lock, /* attr = */ NULL); @@ -451,11 +449,14 @@ static int wg_config_carbon (oconfig_item_t *ci) else if (strcasecmp ("Postfix", child->key) == 0) cf_util_get_string (child, &cb->postfix); else if (strcasecmp ("StoreRates", child->key) == 0) - cf_util_get_boolean (child, &cb->store_rates); + cf_util_get_flag (child, &cb->format_flags, + GRAPHITE_STORE_RATES); else if (strcasecmp ("SeparateInstances", child->key) == 0) - cf_util_get_boolean (child, &cb->separate_instances); + cf_util_get_flag (child, &cb->format_flags, + GRAPHITE_SEPARATE_INSTANCES); else if (strcasecmp ("AlwaysAppendDS", child->key) == 0) - cf_util_get_boolean (child, &cb->always_append_ds); + cf_util_get_flag (child, &cb->format_flags, + GRAPHITE_ALWAYS_APPEND_DS); else if (strcasecmp ("EscapeCharacter", child->key) == 0) config_set_char (&cb->escape_char, child); else