diff --git a/modules/distributor/distributor.go b/modules/distributor/distributor.go index 26936f9b468..662c78ba3eb 100644 --- a/modules/distributor/distributor.go +++ b/modules/distributor/distributor.go @@ -629,14 +629,14 @@ func requestsByTraceID(batches []*v1.ResourceSpans, userID string, spanCount, ma func processAttributes(attributes []*v1_common.KeyValue, maxAttrSize int, count *int) { for _, attr := range attributes { if len(attr.Key) > maxAttrSize { - attr.Key = attr.Key[:maxAttrSize] + "_truncated" + attr.Key = attr.Key[:maxAttrSize] *count++ } switch value := attr.GetValue().Value.(type) { case *v1_common.AnyValue_StringValue: if len(value.StringValue) > maxAttrSize { - value.StringValue = value.StringValue[:maxAttrSize] + "_truncated" + value.StringValue = value.StringValue[:maxAttrSize] *count++ } default: diff --git a/modules/distributor/distributor_test.go b/modules/distributor/distributor_test.go index e048815e18e..e5ff5a92641 100644 --- a/modules/distributor/distributor_test.go +++ b/modules/distributor/distributor_test.go @@ -753,10 +753,10 @@ func TestProcessAttributes(t *testing.T) { // find large resource attributes for _, attr := range resource.Resource.Attributes { if attr.Key == "long value" { - assert.Equal(t, longString[:maxAttrByte]+"_truncated", attr.Value.GetStringValue()) + assert.Equal(t, longString[:maxAttrByte], attr.Value.GetStringValue()) } if attr.Value.GetStringValue() == "long key" { - assert.Equal(t, longString[:maxAttrByte]+"_truncated", attr.Key) + assert.Equal(t, longString[:maxAttrByte], attr.Key) } } // find large span attributes @@ -764,10 +764,10 @@ func TestProcessAttributes(t *testing.T) { for _, span := range scope.Spans { for _, attr := range span.Attributes { if attr.Key == "long value" { - assert.Equal(t, longString[:maxAttrByte]+"_truncated", attr.Value.GetStringValue()) + assert.Equal(t, longString[:maxAttrByte], attr.Value.GetStringValue()) } if attr.Value.GetStringValue() == "long key" { - assert.Equal(t, longString[:maxAttrByte]+"_truncated", attr.Key) + assert.Equal(t, longString[:maxAttrByte], attr.Key) } } } @@ -796,6 +796,7 @@ func BenchmarkTestsByRequestID(b *testing.B) { } b.ResetTimer() + b.ReportAllocs() for i := 0; i < b.N; i++ { for _, blerg := range ils {