Skip to content

Commit 8dcbc96

Browse files
committed
reset buf before calling EncodeConnectionDirect
1 parent 5f87909 commit 8dcbc96

File tree

6 files changed

+1
-5
lines changed

6 files changed

+1
-5
lines changed

pkg/network/encoding/marshal/usm_http.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newHTTPEncoder(httpPayloads map[http.Key]*http.RequestStats) *httpEncoder {
3737
}
3838

3939
func (e *httpEncoder) EncodeConnectionDirect(c network.ConnectionStats, conn *model.Connection, buf *bytes.Buffer) (staticTags uint64, dynamicTags map[string]struct{}) {
40-
buf.Reset()
4140
staticTags, dynamicTags = e.encodeData(c, buf)
4241
conn.HttpAggregations = buf.Bytes()
4342
return

pkg/network/encoding/marshal/usm_http2.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newHTTP2Encoder(http2Payloads map[http.Key]*http.RequestStats) *http2Encode
3737
}
3838

3939
func (e *http2Encoder) EncodeConnectionDirect(c network.ConnectionStats, conn *model.Connection, buf *bytes.Buffer) (staticTags uint64, dynamicTags map[string]struct{}) {
40-
buf.Reset()
4140
staticTags, dynamicTags = e.encodeData(c, buf)
4241
conn.Http2Aggregations = buf.Bytes()
4342
return

pkg/network/encoding/marshal/usm_kafka.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newKafkaEncoder(kafkaPayloads map[kafka.Key]*kafka.RequestStats) *kafkaEnco
3737
}
3838

3939
func (e *kafkaEncoder) EncodeConnectionDirect(c network.ConnectionStats, conn *model.Connection, buf *bytes.Buffer) (staticTags uint64, dynamicTags map[string]struct{}) {
40-
buf.Reset()
4140
staticTags = e.encodeData(c, buf)
4241
conn.DataStreamsAggregations = buf.Bytes()
4342
return

pkg/network/encoding/marshal/usm_postgres.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newPostgresEncoder(postgresPayloads map[postgres.Key]*postgres.RequestStat)
3737
}
3838

3939
func (e *postgresEncoder) EncodeConnectionDirect(c network.ConnectionStats, conn *model.Connection, buf *bytes.Buffer) (staticTags uint64, dynamicTags map[string]struct{}) {
40-
buf.Reset()
4140
staticTags = e.encodeData(c, buf)
4241
conn.DatabaseAggregations = buf.Bytes()
4342
return

pkg/network/encoding/marshal/usm_redis.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newRedisEncoder(redisPayloads map[redis.Key]*redis.RequestStats) *redisEnco
3737
}
3838

3939
func (e *redisEncoder) EncodeConnectionDirect(c network.ConnectionStats, conn *model.Connection, buf *bytes.Buffer) (staticTags uint64, dynamicTags map[string]struct{}) {
40-
buf.Reset()
4140
staticTags = e.encodeData(c, buf)
4241
conn.DatabaseAggregations = buf.Bytes()
4342
return

pkg/network/sender/tags.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (d *directSender) addTags(nc network.ConnectionStats, c *model.Connection,
117117
var staticTags uint64
118118
dynamicTags := nc.TLSTags.GetDynamicTags()
119119
for _, encoder := range usmEncoders {
120+
d.encodeBuf.Reset()
120121
encoderStaticTags, encoderDynamicTags := encoder.EncodeConnectionDirect(nc, c, &d.encodeBuf)
121122
staticTags |= encoderStaticTags
122123
dynamicTags = mergeDynamicTags(dynamicTags, encoderDynamicTags)

0 commit comments

Comments
 (0)