Closed tantra35 closed 1 year ago
seems that follow patch solve problem, it's not ideal, but if it acceptable we can make a PR:
From eb6c7de1c66a8d357e0475cd19a5afd791650e29 Mon Sep 17 00:00:00 2001
From: tantra35 <ruslan.usifov@gmail.com>
Date: Thu, 15 Dec 2022 21:05:31 +0300
Subject: [PATCH] fix tag demage
---
dispatcher.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dispatcher.c b/dispatcher.c
index 4facd7f..4ba6012 100644
--- a/dispatcher.c
+++ b/dispatcher.c
@@ -1021,6 +1021,7 @@ dispatch_received_metrics(connection *conn, dispatcher *self)
firstspace = NULL;
lastnl = NULL;
search_tags = self->tags_supported;
+ char tagfound = 0;
for (p = conn->buf; p - conn->buf < conn->buflen; p++) {
if (*p == '\n' || *p == '\r') {
/* end of metric */
@@ -1086,12 +1087,19 @@ dispatch_received_metrics(connection *conn, dispatcher *self)
/* metric_path separator or space,
* - duplicate elimination
* - don't start with separator/space */
- if (*(q - 1) != *p && (q - 1) != firstspace)
- *q++ = *p;
+ if (tagfound == 0) {
+ if (*(q - 1) != *p && (q - 1) != firstspace)
+ *q++ = *p;
+ } else {
+ if ((q - 1) != firstspace) {
+ *q++ = *p;
+ }
+ }
}
} else if (search_tags && *p == ';') {
/* copy up to next space */
search_tags = 0;
+ tagfound = 1;
firstspace = q;
*q++ = *p;
} else if (
--
2.35.1.windows.2
I've applied a different way (to avoid any modifications/changes), can you try? Thanks!
if we will send metrics with follow tags values
vmrange=8.799e-01...1.000e+00
, tag value will be demaged as transformation tovmrange=8.799e-01.1.000e+00
,here 3 dots was replaced by one, as in this case transformation is wrong for tag value