X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_tail_match.c;h=79868fcdf9a09cdd5670e0d1e22c0f35421a653e;hb=6f5b7579b9ebe88da901b8ba5c50fc3793d2be73;hp=af8bbe7c2dcad17b152cd460ff06083fafee73e2;hpb=6d79874b8afa65cbb4a8e348caf37b8e60fbeded;p=collectd.git diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c index af8bbe7c..79868fcd 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,7 +118,7 @@ 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) - snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f", + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.117s-%.2f", data->type_instance, data->latency_config.percentile[i]); else snprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f", @@ -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,10 +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) - snprintf(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), + "%.54s-%.54s-%.2g_%.2g", data->type, data->type_instance, + lower_bound, upper_bound); else - snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g", + snprintf(vl.type_instance, sizeof(vl.type_instance), "%.107s-%.2g_%.2g", data->type, lower_bound, upper_bound); vl.values = &(value_t){