Repository: kmesh-net/kmesh

Issue:
Updating connOpened metric for the conn report at intervals
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->

**What happened**:
```
func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels workloadMetricLabels) {
	v, ok := m.workloadMetricCache[labels]
	if ok {
		if data.state == TCP_ESTABLISHED {
			v.WorkloadConnOpened = v.WorkloadConnOpened + 1
		}
```
Updating long-conn open metric for  conn report at intervals

**What you expected to happen**:
It should only update for the first report

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:

**Environment**:

- Kmesh version:
- Kmesh mode(kmesh has `Kernel-Native Mode` and `Duel-Engine Mode`):
- Istio version:
- Kernel version:
- Others:


Hints from issue comments:

Solution patch:
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfeb.go
index cbac535e..68112e45 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfeb.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfeb.go
@@ -48,7 +48,12 @@ type KmeshCgroupSkbSockStorageData struct {
 	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
-	_              [6]byte
+	ViaWaypoint    bool
+	HasEncoded     bool
+	HasSetIp       bool
+	_              [3]byte
+	SkTuple        KmeshCgroupSkbBpfSockTuple
+	_              [4]byte
 }
 
 // LoadKmeshCgroupSkb returns the embedded CollectionSpec for KmeshCgroupSkb.
@@ -108,18 +113,17 @@ type KmeshCgroupSkbMapSpecs struct {
 	KmFrontend    *ebpf.MapSpec `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.MapSpec `ebpf:"km_log_event"`
 	KmManage      *ebpf.MapSpec `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.MapSpec `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.MapSpec `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.MapSpec `ebpf:"km_perf_map"`
 	KmService     *ebpf.MapSpec `ebpf:"km_service"`
 	KmSockstorage *ebpf.MapSpec `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.MapSpec `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.MapSpec `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.MapSpec `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.MapSpec `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.MapSpec `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.MapSpec `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.MapSpec `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.MapSpec `ebpf:"map_of_tcp_probe"`
 }
 
 // KmeshCgroupSkbVariableSpecs contains global variables before they are loaded into the kernel.
@@ -157,18 +161,17 @@ type KmeshCgroupSkbMaps struct {
 	KmFrontend    *ebpf.Map `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.Map `ebpf:"km_log_event"`
 	KmManage      *ebpf.Map `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.Map `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.Map `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.Map `ebpf:"km_perf_map"`
 	KmService     *ebpf.Map `ebpf:"km_service"`
 	KmSockstorage *ebpf.Map `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.Map `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.Map `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.Map `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.Map `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.Map `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.Map `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.Map `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.Map `ebpf:"map_of_tcp_probe"`
 }
 
 func (m *KmeshCgroupSkbMaps) Close() error {
@@ -180,18 +183,17 @@ func (m *KmeshCgroupSkbMaps) Close() error {
 		m.KmFrontend,
 		m.KmLogEvent,
 		m.KmManage,
-		m.KmOrigDst,
 		m.KmPerfInfo,
 		m.KmPerfMap,
 		m.KmService,
 		m.KmSockstorage,
-		m.KmTcpProbe,
 		m.KmTmpbuf,
 		m.KmWlpolicy,
 		m.KmeshMap1600,
 		m.KmeshMap192,
 		m.KmeshMap296,
 		m.KmeshMap64,
+		m.MapOfTcpProbe,
 	)
 }
 
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfel.go
index a7094e34..d0c6103f 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfel.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskb_bpfel.go
@@ -48,7 +48,12 @@ type KmeshCgroupSkbSockStorageData struct {
 	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
-	_              [6]byte
+	ViaWaypoint    bool
+	HasEncoded     bool
+	HasSetIp       bool
+	_              [3]byte
+	SkTuple        KmeshCgroupSkbBpfSockTuple
+	_              [4]byte
 }
 
 // LoadKmeshCgroupSkb returns the embedded CollectionSpec for KmeshCgroupSkb.
@@ -108,18 +113,17 @@ type KmeshCgroupSkbMapSpecs struct {
 	KmFrontend    *ebpf.MapSpec `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.MapSpec `ebpf:"km_log_event"`
 	KmManage      *ebpf.MapSpec `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.MapSpec `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.MapSpec `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.MapSpec `ebpf:"km_perf_map"`
 	KmService     *ebpf.MapSpec `ebpf:"km_service"`
 	KmSockstorage *ebpf.MapSpec `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.MapSpec `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.MapSpec `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.MapSpec `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.MapSpec `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.MapSpec `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.MapSpec `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.MapSpec `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.MapSpec `ebpf:"map_of_tcp_probe"`
 }
 
 // KmeshCgroupSkbVariableSpecs contains global variables before they are loaded into the kernel.
@@ -157,18 +161,17 @@ type KmeshCgroupSkbMaps struct {
 	KmFrontend    *ebpf.Map `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.Map `ebpf:"km_log_event"`
 	KmManage      *ebpf.Map `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.Map `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.Map `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.Map `ebpf:"km_perf_map"`
 	KmService     *ebpf.Map `ebpf:"km_service"`
 	KmSockstorage *ebpf.Map `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.Map `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.Map `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.Map `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.Map `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.Map `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.Map `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.Map `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.Map `ebpf:"map_of_tcp_probe"`
 }
 
 func (m *KmeshCgroupSkbMaps) Close() error {
@@ -180,18 +183,17 @@ func (m *KmeshCgroupSkbMaps) Close() error {
 		m.KmFrontend,
 		m.KmLogEvent,
 		m.KmManage,
-		m.KmOrigDst,
 		m.KmPerfInfo,
 		m.KmPerfMap,
 		m.KmService,
 		m.KmSockstorage,
-		m.KmTcpProbe,
 		m.KmTmpbuf,
 		m.KmWlpolicy,
 		m.KmeshMap1600,
 		m.KmeshMap192,
 		m.KmeshMap296,
 		m.KmeshMap64,
+		m.MapOfTcpProbe,
 	)
 }
 
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfeb.go
index 7de8437a..f839db54 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfeb.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfeb.go
@@ -48,7 +48,12 @@ type KmeshCgroupSkbCompatSockStorageData struct {
 	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
-	_              [6]byte
+	ViaWaypoint    bool
+	HasEncoded     bool
+	HasSetIp       bool
+	_              [3]byte
+	SkTuple        KmeshCgroupSkbCompatBpfSockTuple
+	_              [4]byte
 }
 
 // LoadKmeshCgroupSkbCompat returns the embedded CollectionSpec for KmeshCgroupSkbCompat.
@@ -108,18 +113,17 @@ type KmeshCgroupSkbCompatMapSpecs struct {
 	KmFrontend    *ebpf.MapSpec `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.MapSpec `ebpf:"km_log_event"`
 	KmManage      *ebpf.MapSpec `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.MapSpec `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.MapSpec `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.MapSpec `ebpf:"km_perf_map"`
 	KmService     *ebpf.MapSpec `ebpf:"km_service"`
 	KmSockstorage *ebpf.MapSpec `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.MapSpec `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.MapSpec `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.MapSpec `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.MapSpec `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.MapSpec `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.MapSpec `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.MapSpec `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.MapSpec `ebpf:"map_of_tcp_probe"`
 }
 
 // KmeshCgroupSkbCompatVariableSpecs contains global variables before they are loaded into the kernel.
@@ -157,18 +161,17 @@ type KmeshCgroupSkbCompatMaps struct {
 	KmFrontend    *ebpf.Map `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.Map `ebpf:"km_log_event"`
 	KmManage      *ebpf.Map `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.Map `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.Map `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.Map `ebpf:"km_perf_map"`
 	KmService     *ebpf.Map `ebpf:"km_service"`
 	KmSockstorage *ebpf.Map `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.Map `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.Map `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.Map `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.Map `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.Map `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.Map `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.Map `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.Map `ebpf:"map_of_tcp_probe"`
 }
 
 func (m *KmeshCgroupSkbCompatMaps) Close() error {
@@ -180,18 +183,17 @@ func (m *KmeshCgroupSkbCompatMaps) Close() error {
 		m.KmFrontend,
 		m.KmLogEvent,
 		m.KmManage,
-		m.KmOrigDst,
 		m.KmPerfInfo,
 		m.KmPerfMap,
 		m.KmService,
 		m.KmSockstorage,
-		m.KmTcpProbe,
 		m.KmTmpbuf,
 		m.KmWlpolicy,
 		m.KmeshMap1600,
 		m.KmeshMap192,
 		m.KmeshMap296,
 		m.KmeshMap64,
+		m.MapOfTcpProbe,
 	)
 }
 
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfel.go
index dd3a8974..dd0b30d6 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfel.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupskbcompat_bpfel.go
@@ -48,7 +48,12 @@ type KmeshCgroupSkbCompatSockStorageData struct {
 	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
-	_              [6]byte
+	ViaWaypoint    bool
+	HasEncoded     bool
+	HasSetIp       bool
+	_              [3]byte
+	SkTuple        KmeshCgroupSkbCompatBpfSockTuple
+	_              [4]byte
 }
 
 // LoadKmeshCgroupSkbCompat returns the embedded CollectionSpec for KmeshCgroupSkbCompat.
@@ -108,18 +113,17 @@ type KmeshCgroupSkbCompatMapSpecs struct {
 	KmFrontend    *ebpf.MapSpec `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.MapSpec `ebpf:"km_log_event"`
 	KmManage      *ebpf.MapSpec `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.MapSpec `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.MapSpec `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.MapSpec `ebpf:"km_perf_map"`
 	KmService     *ebpf.MapSpec `ebpf:"km_service"`
 	KmSockstorage *ebpf.MapSpec `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.MapSpec `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.MapSpec `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.MapSpec `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.MapSpec `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.MapSpec `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.MapSpec `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.MapSpec `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.MapSpec `ebpf:"map_of_tcp_probe"`
 }
 
 // KmeshCgroupSkbCompatVariableSpecs contains global variables before they are loaded into the kernel.
@@ -157,18 +161,17 @@ type KmeshCgroupSkbCompatMaps struct {
 	KmFrontend    *ebpf.Map `ebpf:"km_frontend"`
 	KmLogEvent    *ebpf.Map `ebpf:"km_log_event"`
 	KmManage      *ebpf.Map `ebpf:"km_manage"`
-	KmOrigDst     *ebpf.Map `ebpf:"km_orig_dst"`
 	KmPerfInfo    *ebpf.Map `ebpf:"km_perf_info"`
 	KmPerfMap     *ebpf.Map `ebpf:"km_perf_map"`
 	KmService     *ebpf.Map `ebpf:"km_service"`
 	KmSockstorage *ebpf.Map `ebpf:"km_sockstorage"`
-	KmTcpProbe    *ebpf.Map `ebpf:"km_tcp_probe"`
 	KmTmpbuf      *ebpf.Map `ebpf:"km_tmpbuf"`
 	KmWlpolicy    *ebpf.Map `ebpf:"km_wlpolicy"`
 	KmeshMap1600  *ebpf.Map `ebpf:"kmesh_map1600"`
 	KmeshMap192   *ebpf.Map `ebpf:"kmesh_map192"`
 	KmeshMap296   *ebpf.Map `ebpf:"kmesh_map296"`
 	KmeshMap64    *ebpf.Map `ebpf:"kmesh_map64"`
+	MapOfTcpProbe *ebpf.Map `ebpf:"map_of_tcp_probe"`
 }
 
 func (m *KmeshCgroupSkbCompatMaps) Close() error {
@@ -180,18 +183,17 @@ func (m *KmeshCgroupSkbCompatMaps) Close() error {
 		m.KmFrontend,
 		m.KmLogEvent,
 		m.KmManage,
-		m.KmOrigDst,
 		m.KmPerfInfo,
 		m.KmPerfMap,
 		m.KmService,
 		m.KmSockstorage,
-		m.KmTcpProbe,
 		m.KmTmpbuf,
 		m.KmWlpolicy,
 		m.KmeshMap1600,
 		m.KmeshMap192,
 		m.KmeshMap296,
 		m.KmeshMap64,
+		m.MapOfTcpProbe,
 	)
 }
 
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go
index 7f5d79f3..bdafcf41 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go
@@ -21,6 +21,7 @@ type KmeshSendmsgManagerKey struct {
 
 type KmeshSendmsgSockStorageData struct {
 	ConnectNs      uint64
+	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
 	ViaWaypoint    bool
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go
index 5335e006..4aea84e1 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go
@@ -21,6 +21,7 @@ type KmeshSendmsgManagerKey struct {
 
 type KmeshSendmsgSockStorageData struct {
 	ConnectNs      uint64
+	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
 	ViaWaypoint    bool
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go
index 384b8abb..899a1f85 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go
@@ -21,6 +21,7 @@ type KmeshSendmsgCompatManagerKey struct {
 
 type KmeshSendmsgCompatSockStorageData struct {
 	ConnectNs      uint64
+	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
 	ViaWaypoint    bool
diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go
index b262f3b9..4fa9e0d8 100644
--- a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go
+++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go
@@ -21,6 +21,7 @@ type KmeshSendmsgCompatManagerKey struct {
 
 type KmeshSendmsgCompatSockStorageData struct {
 	ConnectNs      uint64
+	LastReportNs   uint64
 	Direction      uint8
 	ConnectSuccess uint8
 	ViaWaypoint    bool
diff --git a/bpf/kmesh/workload/cgroup_skb.c b/bpf/kmesh/workload/cgroup_skb.c
index 7a57fd31..e12dec6c 100644
--- a/bpf/kmesh/workload/cgroup_skb.c
+++ b/bpf/kmesh/workload/cgroup_skb.c
@@ -6,7 +6,6 @@
 #include <bpf/bpf_endian.h>
 #include <bpf/bpf_helpers.h>
 #include "bpf_log.h"
-#include "encoder.h"
 #include "bpf_common.h"
 #include "probe.h"
 
diff --git a/pkg/controller/telemetry/metric.go b/pkg/controller/telemetry/metric.go
index 8e6fbaa7..fd683632 100644
--- a/pkg/controller/telemetry/metric.go
+++ b/pkg/controller/telemetry/metric.go
@@ -144,6 +144,7 @@ type connMetric struct {
 	sentBytes     uint32 // total bytes sent till now
 	totalRetrans  uint32 // total retransmits till now
 	packetLost    uint32 // total packets lost till now
+	totalReports  uint32 // number of times the metric is reported to ringbuffer
 }
 
 type connectionSrcDst struct {
@@ -422,9 +423,9 @@ func (m *MetricController) Run(ctx context.Context, mapOfTcpInfo *ebpf.Map) {
 
 			m.mutex.Lock()
 			if m.EnableWorkloadMetric.Load() {
-				m.updateWorkloadMetricCache(data, workloadLabels)
+				m.updateWorkloadMetricCache(data, workloadLabels, tcp_conns)
 			}
-			m.updateServiceMetricCache(data, serviceLabels)
+			m.updateServiceMetricCache(data, serviceLabels, tcp_conns)
 			m.mutex.Unlock()
 		}
 	}
@@ -466,11 +467,22 @@ func buildV4Metric(buf *bytes.Buffer, tcp_conns map[connectionSrcDst]connMetric)
 	data.minRtt = connectData.statistics.RttMin
 	data.totalRetrans = connectData.statistics.Retransmits - tcp_conns[data.conSrcDstInfo].totalRetrans
 	data.packetLost = connectData.statistics.LostPackets - tcp_conns[data.conSrcDstInfo].packetLost
-	tcp_conns[data.conSrcDstInfo] = connMetric{
-		receivedBytes: connectData.ReceivedBytes,
-		sentBytes:     connectData.SentBytes,
-		totalRetrans:  connectData.statistics.Retransmits,
-		packetLost:    connectData.statistics.LostPackets,
+
+	cm, ok := tcp_conns[data.conSrcDstInfo]
+	if ok {
+		cm.receivedBytes = connectData.ReceivedBytes
+		cm.sentBytes = connectData.SentBytes
+		cm.totalRetrans = connectData.statistics.Retransmits
+		cm.packetLost = connectData.statistics.LostPackets
+		cm.totalReports++
+	} else {
+		tcp_conns[data.conSrcDstInfo] = connMetric{
+			receivedBytes: connectData.ReceivedBytes,
+			sentBytes:     connectData.SentBytes,
+			totalRetrans:  connectData.statistics.Retransmits,
+			packetLost:    connectData.statistics.LostPackets,
+			totalReports:  1,
+		}
 	}
 
 	return data, nil
@@ -510,11 +522,22 @@ func buildV6Metric(buf *bytes.Buffer, tcp_conns map[connectionSrcDst]connMetric)
 	data.minRtt = connectData.statistics.RttMin
 	data.totalRetrans = connectData.statistics.Retransmits - tcp_conns[data.conSrcDstInfo].totalRetrans
 	data.packetLost = connectData.statistics.LostPackets - tcp_conns[data.conSrcDstInfo].packetLost
-	tcp_conns[data.conSrcDstInfo] = connMetric{
-		receivedBytes: connectData.ReceivedBytes,
-		sentBytes:     connectData.SentBytes,
-		totalRetrans:  connectData.statistics.Retransmits,
-		packetLost:    connectData.statistics.LostPackets,
+
+	cm, ok := tcp_conns[data.conSrcDstInfo]
+	if ok {
+		cm.receivedBytes = connectData.ReceivedBytes
+		cm.sentBytes = connectData.SentBytes
+		cm.totalRetrans = connectData.statistics.Retransmits
+		cm.packetLost = connectData.statistics.LostPackets
+		cm.totalReports++
+	} else {
+		tcp_conns[data.conSrcDstInfo] = connMetric{
+			receivedBytes: connectData.ReceivedBytes,
+			sentBytes:     connectData.SentBytes,
+			totalRetrans:  connectData.statistics.Retransmits,
+			packetLost:    connectData.statistics.LostPackets,
+			totalReports:  1,
+		}
 	}
 
 	return data, nil
@@ -669,10 +692,10 @@ func buildPrincipal(workload *workloadapi.Workload) string {
 	return DEFAULT_UNKNOWN
 }
 
-func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels workloadMetricLabels) {
+func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels workloadMetricLabels, tcp_conns map[connectionSrcDst]connMetric) {
 	v, ok := m.workloadMetricCache[labels]
 	if ok {
-		if data.state == TCP_ESTABLISHED {
+		if data.state == TCP_ESTABLISHED && tcp_conns[data.conSrcDstInfo].totalReports == 1 {
 			v.WorkloadConnOpened = v.WorkloadConnOpened + 1
 		}
 		if data.state == TCP_CLOSTED {
@@ -687,7 +710,7 @@ func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels
 		v.WorkloadConnPacketLost = v.WorkloadConnPacketLost + float64(data.packetLost)
 	} else {
 		newWorkloadMetricInfo := workloadMetricInfo{}
-		if data.state == TCP_ESTABLISHED {
+		if data.state == TCP_ESTABLISHED && tcp_conns[data.conSrcDstInfo].totalReports == 1 {
 			newWorkloadMetricInfo.WorkloadConnOpened = 1
 		}
 		if data.state == TCP_CLOSTED {
@@ -704,10 +727,10 @@ func (m *MetricController) updateWorkloadMetricCache(data requestMetric, labels
 	}
 }
 
-func (m *MetricController) updateServiceMetricCache(data requestMetric, labels serviceMetricLabels) {
+func (m *MetricController) updateServiceMetricCache(data requestMetric, labels serviceMetricLabels, tcp_conns map[connectionSrcDst]connMetric) {
 	v, ok := m.serviceMetricCache[labels]
 	if ok {
-		if data.state == TCP_ESTABLISHED {
+		if data.state == TCP_ESTABLISHED && tcp_conns[data.conSrcDstInfo].totalReports == 1 {
 			v.ServiceConnOpened = v.ServiceConnOpened + 1
 		}
 		if data.state == TCP_CLOSTED {
@@ -720,7 +743,7 @@ func (m *MetricController) updateServiceMetricCache(data requestMetric, labels s
 		v.ServiceConnSentBytes = v.ServiceConnSentBytes + float64(data.sentBytes)
 	} else {
 		newServiceMetricInfo := serviceMetricInfo{}
-		if data.state == TCP_ESTABLISHED {
+		if data.state == TCP_ESTABLISHED && tcp_conns[data.conSrcDstInfo].totalReports == 1 {
 			newServiceMetricInfo.ServiceConnOpened = 1
 		}
 		if data.state == TCP_CLOSTED {



Test patch:
diff --git a/pkg/controller/telemetry/metric_test.go b/pkg/controller/telemetry/metric_test.go
index 4f69a736..01045c79 100644
--- a/pkg/controller/telemetry/metric_test.go
+++ b/pkg/controller/telemetry/metric_test.go
@@ -175,8 +175,9 @@ func TestCommonTrafficLabels2map(t *testing.T) {
 
 func TestBuildMetricsToPrometheus(t *testing.T) {
 	type args struct {
-		data   requestMetric
-		labels workloadMetricLabels
+		data      requestMetric
+		labels    workloadMetricLabels
+		tcp_conns map[connectionSrcDst]connMetric
 	}
 	tests := []struct {
 		name string
@@ -222,6 +223,14 @@ func TestBuildMetricsToPrometheus(t *testing.T) {
 					responseFlags:                "-",
 					connectionSecurityPolicy:     "mutual_tls",
 				},
+				tcp_conns: map[connectionSrcDst]connMetric{
+					{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					}: {
+						totalReports: 1,
+					},
+				},
 			},
 			want: []float64{
 				0,
@@ -232,6 +241,63 @@ func TestBuildMetricsToPrometheus(t *testing.T) {
 				2,
 			},
 		},
+		{
+			name: "test build workload metrisc to metricCache for conn report at intervals",
+			args: args{
+				data: requestMetric{
+					conSrcDstInfo: connectionSrcDst{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					},
+					sentBytes:     0x0000003,
+					receivedBytes: 0x0000004,
+					packetLost:    0x0000001,
+					totalRetrans:  0x0000002,
+					state:         TCP_ESTABLISHED,
+				},
+				labels: workloadMetricLabels{
+					reporter:                     "destination",
+					sourceWorkload:               "sleep",
+					sourceCanonicalService:       "sleep",
+					sourceCanonicalRevision:      "latest",
+					sourceWorkloadNamespace:      "ambient-demo",
+					sourcePrincipal:              "spiffe://cluster.local/ns/ambient-demo/sa/sleep",
+					sourceApp:                    "sleep",
+					sourceVersion:                "latest",
+					sourceCluster:                "Kubernetes",
+					destinationPodAddress:        "192.168.20.25",
+					destinationPodNamespace:      "ambient-demo",
+					destinationPodName:           "tcp-echo",
+					destinationWorkload:          "tcp-echo",
+					destinationCanonicalService:  "tcp-echo",
+					destinationCanonicalRevision: "v1",
+					destinationWorkloadNamespace: "ambient-demo",
+					destinationPrincipal:         "spiffe://cluster.local/ns/ambient-demo/sa/default",
+					destinationApp:               "tcp-echo",
+					destinationVersion:           "v1",
+					destinationCluster:           "Kubernetes",
+					requestProtocol:              "tcp",
+					responseFlags:                "-",
+					connectionSecurityPolicy:     "mutual_tls",
+				},
+				tcp_conns: map[connectionSrcDst]connMetric{
+					{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					}: {
+						totalReports: 3,
+					},
+				},
+			},
+			want: []float64{
+				0,
+				0,
+				4,
+				3,
+				1,
+				2,
+			},
+		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -240,7 +306,7 @@ func TestBuildMetricsToPrometheus(t *testing.T) {
 				workloadMetricCache: map[workloadMetricLabels]*workloadMetricInfo{},
 				serviceMetricCache:  map[serviceMetricLabels]*serviceMetricInfo{},
 			}
-			m.updateWorkloadMetricCache(tt.args.data, tt.args.labels)
+			m.updateWorkloadMetricCache(tt.args.data, tt.args.labels, tt.args.tcp_conns)
 			assert.Equal(t, m.workloadMetricCache[tt.args.labels].WorkloadConnClosed, tt.want[0])
 			assert.Equal(t, m.workloadMetricCache[tt.args.labels].WorkloadConnOpened, tt.want[1])
 			assert.Equal(t, m.workloadMetricCache[tt.args.labels].WorkloadConnReceivedBytes, tt.want[2])
@@ -253,8 +319,9 @@ func TestBuildMetricsToPrometheus(t *testing.T) {
 
 func TestBuildServiceMetricsToPrometheus(t *testing.T) {
 	type args struct {
-		data   requestMetric
-		labels serviceMetricLabels
+		data      requestMetric
+		labels    serviceMetricLabels
+		tcp_conns map[connectionSrcDst]connMetric
 	}
 	tests := []struct {
 		name string
@@ -297,6 +364,14 @@ func TestBuildServiceMetricsToPrometheus(t *testing.T) {
 					responseFlags:                "-",
 					connectionSecurityPolicy:     "mutual_tls",
 				},
+				tcp_conns: map[connectionSrcDst]connMetric{
+					{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					}: {
+						totalReports: 1,
+					},
+				},
 			},
 			want: []float64{
 				0,
@@ -305,6 +380,58 @@ func TestBuildServiceMetricsToPrometheus(t *testing.T) {
 				9,
 			},
 		},
+		{
+			name: "build service metrics in metricCache for conn report at interval",
+			args: args{
+				data: requestMetric{
+					conSrcDstInfo: connectionSrcDst{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					},
+					sentBytes:     0x0000009,
+					receivedBytes: 0x0000008,
+					state:         TCP_ESTABLISHED,
+				},
+				labels: serviceMetricLabels{
+					sourceWorkload:               "kmesh-daemon",
+					sourceCanonicalService:       "srcCanonical",
+					sourceCanonicalRevision:      "srcVersion",
+					sourceWorkloadNamespace:      "kmesh-system",
+					sourcePrincipal:              "spiffe://cluster.local/ns/kmesh-system/sa/default",
+					sourceApp:                    "srcCanonical",
+					sourceVersion:                "srcVersion",
+					sourceCluster:                "Kubernetes",
+					destinationService:           "kmesh.kmesh-system.svc.cluster.local",
+					destinationServiceNamespace:  "kmesh-system",
+					destinationServiceName:       "kmesh.kmesh-system.svc.cluster.local",
+					destinationWorkload:          "kmesh-daemon",
+					destinationCanonicalService:  "dstCanonical",
+					destinationCanonicalRevision: "dstVersion",
+					destinationWorkloadNamespace: "kmesh-system",
+					destinationPrincipal:         "spiffe://cluster.local/ns/kmesh-system/sa/default",
+					destinationApp:               "dstCanonical",
+					destinationVersion:           "dstVersion",
+					destinationCluster:           "Kubernetes",
+					requestProtocol:              "tcp",
+					responseFlags:                "-",
+					connectionSecurityPolicy:     "mutual_tls",
+				},
+				tcp_conns: map[connectionSrcDst]connMetric{
+					{
+						src: [4]uint32{183763210, 0, 0, 0},
+						dst: [4]uint32{183762951, 0, 0, 0},
+					}: {
+						totalReports: 3,
+					},
+				},
+			},
+			want: []float64{
+				0,
+				0,
+				8,
+				9,
+			},
+		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -313,7 +440,7 @@ func TestBuildServiceMetricsToPrometheus(t *testing.T) {
 				workloadMetricCache: map[workloadMetricLabels]*workloadMetricInfo{},
 				serviceMetricCache:  map[serviceMetricLabels]*serviceMetricInfo{},
 			}
-			m.updateServiceMetricCache(tt.args.data, tt.args.labels)
+			m.updateServiceMetricCache(tt.args.data, tt.args.labels, tt.args.tcp_conns)
 			assert.Equal(t, m.serviceMetricCache[tt.args.labels].ServiceConnClosed, tt.want[0])
 			assert.Equal(t, m.serviceMetricCache[tt.args.labels].ServiceConnOpened, tt.want[1])
 			assert.Equal(t, m.serviceMetricCache[tt.args.labels].ServiceConnReceivedBytes, tt.want[2])