@@ -42,6 +42,8 @@ const (
4242
4343 connection_success = uint32 (1 )
4444
45+ MSG_LEN = 96
46+
4547 metricFlushInterval = 5 * time .Second
4648
4749 DEFAULT_UNKNOWN = "-"
@@ -66,6 +68,8 @@ type workloadMetricInfo struct {
6668 WorkloadConnSentBytes float64
6769 WorkloadConnReceivedBytes float64
6870 WorkloadConnFailed float64
71+ WorkloadConnTotalRetrans float64
72+ WorkloadConnPacketLost float64
6973}
7074
7175type serviceMetricInfo struct {
@@ -88,10 +92,7 @@ type statistics struct {
8892 Protocol uint32
8993 SRttTime uint32
9094 RttMin uint32
91- MssCache uint32
9295 Retransmits uint32
93- SegmentsIn uint32
94- SegmentsOut uint32
9596 LostPackets uint32
9697}
9798
@@ -135,6 +136,10 @@ type requestMetric struct {
135136 success uint32
136137 duration uint64
137138 closeTime uint64
139+ srtt uint32
140+ minRtt uint32
141+ totalRetrans uint32
142+ PacketLost uint32
138143}
139144
140145type workloadMetricLabels struct {
@@ -408,6 +413,10 @@ func buildV4Metric(buf *bytes.Buffer) (requestMetric, error) {
408413 data .success = connectData .ConnectSuccess
409414 data .duration = connectData .Duration
410415 data .closeTime = connectData .CloseTime
416+ data .srtt = connectData .statistics .SRttTime
417+ data .minRtt = connectData .statistics .RttMin
418+ data .totalRetrans = connectData .statistics .Retransmits
419+ data .PacketLost = connectData .statistics .LostPackets
411420
412421 return data , nil
413422}
@@ -441,6 +450,10 @@ func buildV6Metric(buf *bytes.Buffer) (requestMetric, error) {
441450 data .success = connectData .ConnectSuccess
442451 data .duration = connectData .Duration
443452 data .closeTime = connectData .CloseTime
453+ data .srtt = connectData .statistics .SRttTime
454+ data .minRtt = connectData .statistics .RttMin
455+ data .totalRetrans = connectData .statistics .Retransmits
456+ data .PacketLost = connectData .statistics .LostPackets
444457
445458 return data , nil
446459}
@@ -607,6 +620,8 @@ func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels
607620 }
608621 v .WorkloadConnReceivedBytes = v .WorkloadConnReceivedBytes + float64 (data .receivedBytes )
609622 v .WorkloadConnSentBytes = v .WorkloadConnSentBytes + float64 (data .sentBytes )
623+ v .WorkloadConnTotalRetrans = v .WorkloadConnTotalRetrans + float64 (data .totalRetrans )
624+ v .WorkloadConnPacketLost = v .WorkloadConnPacketLost + float64 (data .PacketLost )
610625 } else {
611626 newWorkloadMetricInfo := workloadMetricInfo {}
612627 if data .state == TCP_ESTABLISHED {
@@ -620,6 +635,8 @@ func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels
620635 }
621636 newWorkloadMetricInfo .WorkloadConnReceivedBytes = float64 (data .receivedBytes )
622637 newWorkloadMetricInfo .WorkloadConnSentBytes = float64 (data .sentBytes )
638+ newWorkloadMetricInfo .WorkloadConnTotalRetrans = float64 (data .totalRetrans )
639+ newWorkloadMetricInfo .WorkloadConnPacketLost = float64 (data .PacketLost )
623640 m .workloadMetricCache [labels ] = & newWorkloadMetricInfo
624641 }
625642}
@@ -670,6 +687,8 @@ func (m *MetricController) updatePrometheusMetric() {
670687 tcpSentBytesInWorkload .With (workloadLabels ).Add (v .WorkloadConnSentBytes )
671688 tcpReceivedBytesInWorkload .With (workloadLabels ).Add (v .WorkloadConnReceivedBytes )
672689 tcpConnectionFailedInWorkload .With (workloadLabels ).Add (v .WorkloadConnFailed )
690+ tcpConnectionTotalRetransInWorkload .With (workloadLabels ).Add (v .WorkloadConnTotalRetrans )
691+ tcpConnectionPacketLostInWorkload .With (workloadLabels ).Add (v .WorkloadConnPacketLost )
673692 }
674693
675694 for k , v := range serviceInfoCache {
0 commit comments