X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Futils_tail_match.c;h=5134a6e136a14a82938872fdb8f3c2b276ed9257;hp=f046f6b1e8d64c547651d6bbee5ff8a942b031cc;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=9655d4a6d9fa2c4f02032759b831e93933d68bd9 diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c index f046f6b1..5134a6e1 100644 --- a/src/utils_tail_match.c +++ b/src/utils_tail_match.c @@ -108,7 +108,6 @@ static int latency_submit_match(cu_match_t *match, void *user_data) { if (match_value == NULL) return -1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, data->plugin, sizeof(vl.plugin)); sstrncpy(vl.plugin_instance, data->plugin_instance, sizeof(vl.plugin_instance)); @@ -119,11 +118,11 @@ static int latency_submit_match(cu_match_t *match, void *user_data) { sstrncpy(vl.type, data->type, sizeof(vl.type)); for (size_t i = 0; i < data->latency_config.percentile_num; i++) { if (strlen(data->type_instance) != 0) - ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f", - data->type_instance, data->latency_config.percentile[i]); + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.50s-%.5g", + data->type_instance, data->latency_config.percentile[i]); else - ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f", - data->latency_config.percentile[i]); + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.5g", + data->latency_config.percentile[i]); vl.values = &(value_t){ .gauge = @@ -138,7 +137,11 @@ static int latency_submit_match(cu_match_t *match, void *user_data) { } /* Submit buckets */ - sstrncpy(vl.type, "bucket", sizeof(vl.type)); + if (data->latency_config.bucket_type != NULL) + sstrncpy(vl.type, data->latency_config.bucket_type, sizeof(vl.type)); + else + sstrncpy(vl.type, "bucket", sizeof(vl.type)); + for (size_t i = 0; i < data->latency_config.buckets_num; i++) { latency_bucket_t bucket = data->latency_config.buckets[i]; @@ -147,11 +150,11 @@ static int latency_submit_match(cu_match_t *match, void *user_data) { bucket.upper_bound ? CDTIME_T_TO_DOUBLE(bucket.upper_bound) : INFINITY; if (strlen(data->type_instance) != 0) - ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s-%g_%g", - data->type, data->type_instance, lower_bound, upper_bound); + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.50s-%.50s-%g_%g", + data->type, data->type_instance, lower_bound, upper_bound); else - ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g", - data->type, lower_bound, upper_bound); + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.50s-%g_%g", + data->type, lower_bound, upper_bound); vl.values = &(value_t){ .gauge =