We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e6e019 commit 8d3d692Copy full SHA for 8d3d692
metrics-exporter-dogstatsd/src/writer.rs
@@ -83,8 +83,19 @@ impl PayloadWriter {
83
return false;
84
}
85
86
- // Track the new offset.
87
- self.offsets.push(self.buf.len());
+ // Offset update
+ if current_len + self.last_offset() <= self.max_payload_len {
88
+ // If the current metric can be written within the max_payload_len
89
+ // replace the last offset (if there is valid offset)
90
+ if let Some(last_offset) = self.offsets.last_mut() {
91
+ *last_offset = self.buf.len();
92
+ } else {
93
+ self.offsets.push(self.buf.len());
94
+ }
95
96
+ // - else add a new offset to send current metric in a new Packet
97
98
99
100
true
101
0 commit comments