Skip to content

Commit a65d074

Browse files
authored
Code cleanup: Improve calculation of number of bytes in string (#5924)
1 parent fbbccfc commit a65d074

File tree

1 file changed

+1
-1
lines changed
  • packages/dd-trace/src/llmobs/writers

1 file changed

+1
-1
lines changed

packages/dd-trace/src/llmobs/writers/spans.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class LLMObsSpanWriter extends BaseWriter {
3535
if (shouldTruncate) {
3636
logger.warn(`Dropping event input/output because its size (${eventSizeBytes}) exceeds the 1MB event size limit`)
3737
event = this._truncateSpanEvent(event)
38-
processedEventSizeBytes = Buffer.from(JSON.stringify(event)).byteLength
38+
processedEventSizeBytes = Buffer.byteLength(JSON.stringify(event))
3939
}
4040

4141
telemetry.recordLLMObsSpanSize(event, processedEventSizeBytes, shouldTruncate)

0 commit comments

Comments
 (0)