This commit is contained in:
Jakob Borg 2023-06-29 19:34:23 +02:00
parent 9a9b751626
commit 102c3c317e
2 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,12 @@ var (
Name: "recv_bytes_total",
Help: "Total amount of data received",
}, []string{"device"})
metricDeviceRecvDecompressedBytes = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "syncthing",
Subsystem: "protocol",
Name: "recv_decompressed_bytes_total",
Help: "Total amount of data received, after decompression",
}, []string{"device"})
metricDeviceRecvMessages = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "syncthing",
Subsystem: "protocol",

View File

@ -541,6 +541,8 @@ func (c *rawConnection) readMessageAfterHeader(hdr Header, fourByteBuf []byte) (
// ... and is then unmarshalled
metricDeviceRecvDecompressedBytes.WithLabelValues(c.idString).Add(float64(4 + len(buf)))
msg, err := newMessage(hdr.Type)
if err != nil {
BufferPool.Put(buf)
@ -581,6 +583,8 @@ func (c *rawConnection) readHeader(fourByteBuf []byte) (Header, error) {
return Header{}, fmt.Errorf("unmarshalling header: %w", err)
}
metricDeviceRecvDecompressedBytes.WithLabelValues(c.idString).Add(float64(2 + len(buf)))
return hdr, nil
}