diff --git a/lib/protocol/metrics.go b/lib/protocol/metrics.go index b1ea6281c..954597abd 100644 --- a/lib/protocol/metrics.go +++ b/lib/protocol/metrics.go @@ -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", diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index ab14c9884..7a40a72ee 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -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 }