Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: proper formatting of floating point (#7653)

Nityananda Gohain054dea366efc
diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go
index a9bded921c..90cd2940ca 100644
--- a/pkg/query-service/app/clickhouseReader/reader.go
+++ b/pkg/query-service/app/clickhouseReader/reader.go
@@ -1085,7 +1085,7 @@ func (r *ClickHouseReader) GetWaterfallSpansForTraceWithMetadata(ctx context.Con
item.Attributes_string[k] = fmt.Sprintf("%v", v)
}
for k, v := range item.Attributes_number {
- item.Attributes_string[k] = fmt.Sprintf("%v", v)
+ item.Attributes_string[k] = strconv.FormatFloat(v, 'f', -1, 64)
}
for k, v := range item.Resources_string {
item.Attributes_string[k] = v
@@ -4241,11 +4241,12 @@ func readRow(vars []interface{}, columnNames []string, countOfNumberCols int) ([
isValidPoint = true
point.Value = float64(reflect.ValueOf(v).Elem().Float())
} else {
- groupBy = append(groupBy, fmt.Sprintf("%v", reflect.ValueOf(v).Elem().Float()))
+ val := strconv.FormatFloat(reflect.ValueOf(v).Elem().Float(), 'f', -1, 64)
+ groupBy = append(groupBy, val)
if _, ok := groupAttributes[colName]; !ok {
- groupAttributesArray = append(groupAttributesArray, map[string]string{colName: fmt.Sprintf("%v", reflect.ValueOf(v).Elem().Float())})
+ groupAttributesArray = append(groupAttributesArray, map[string]string{colName: val})
}
- groupAttributes[colName] = fmt.Sprintf("%v", reflect.ValueOf(v).Elem().Float())
+ groupAttributes[colName] = val
}
case **float64, **float32:
val := reflect.ValueOf(v)
@@ -4255,11 +4256,12 @@ func readRow(vars []interface{}, columnNames []string, countOfNumberCols int) ([
isValidPoint = true
point.Value = value
} else {
- groupBy = append(groupBy, fmt.Sprintf("%v", value))
+ val := strconv.FormatFloat(value, 'f', -1, 64)
+ groupBy = append(groupBy, val)
if _, ok := groupAttributes[colName]; !ok {
- groupAttributesArray = append(groupAttributesArray, map[string]string{colName: fmt.Sprintf("%v", value)})
+ groupAttributesArray = append(groupAttributesArray, map[string]string{colName: val})
}
- groupAttributes[colName] = fmt.Sprintf("%v", value)
+ groupAttributes[colName] = val
}
}
case *uint, *uint8, *uint64, *uint16, *uint32:
@@ -6889,7 +6891,7 @@ func (r *ClickHouseReader) SearchTracesV2(ctx context.Context, params *model.Sea
item.Attributes_string[k] = fmt.Sprintf("%v", v)
}
for k, v := range item.Attributes_number {
- item.Attributes_string[k] = fmt.Sprintf("%v", v)
+ item.Attributes_string[k] = strconv.FormatFloat(v, 'f', -1, 64)
}
for k, v := range item.Resources_string {
item.Attributes_string[k] = v