Skip to content

Commit

Permalink
Fix metrics for dispatched record size (#154)
Browse files Browse the repository at this point in the history
In datastore, we use Length() to instrument payload size sent to them. However the value which was instrumented was the flatbuffer message. Fixing here to use the actual payload length
  • Loading branch information
agbpatro authored Apr 10, 2024
1 parent 14e2c3d commit e902968
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions telemetry/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,17 @@ func (record *Record) Raw() []byte {
return record.RawBytes
}

// Length gets the records byte size
func (record *Record) Length() int {
// Length gets the records flatbuffer payload byte size
func (record *Record) LengthRawBytes() int {
record.ensureEncoded()
return len(record.RawBytes)
}

// Length gets the records byte size
func (record *Record) Length() int {
return len(record.PayloadBytes)
}

// Encode encodes the records into bytes
func (record *Record) Encode() ([]byte, error) {
record.ensureEncoded()
Expand Down

0 comments on commit e902968

Please sign in to comment.