@@ -246,6 +246,21 @@ func TestDefaultTranslationRules(t *testing.T) {
246
246
require .Equal (t , "host" , dps [0 ].Dimensions [0 ].Key )
247
247
require .Equal (t , "host0" , dps [0 ].Dimensions [0 ].Value )
248
248
249
+ // system.network.io.total new metric calculation
250
+ dps , ok = metrics ["system.network.io.total" ]
251
+ require .True (t , ok , "system.network.io.total metrics not found" )
252
+ require .Equal (t , 2 , len (dps ))
253
+ require .Equal (t , 4 , len (dps [0 ].Dimensions ))
254
+
255
+ // system.network.packets.total new metric calculation
256
+ dps , ok = metrics ["system.network.packets.total" ]
257
+ require .True (t , ok , "system.network.packets.total metrics not found" )
258
+ require .Equal (t , 1 , len (dps ))
259
+ require .Equal (t , 4 , len (dps [0 ].Dimensions ))
260
+ require .Equal (t , int64 (350 ), * dps [0 ].Value .IntValue )
261
+ require .Equal (t , "direction" , dps [0 ].Dimensions [0 ].Key )
262
+ require .Equal (t , "receive" , dps [0 ].Dimensions [0 ].Value )
263
+
249
264
// network.total new metric calculation
250
265
dps , ok = metrics ["network.total" ]
251
266
require .True (t , ok , "network.total metrics not found" )
@@ -639,6 +654,76 @@ func testMetricsData() pdata.ResourceMetrics {
639
654
},
640
655
},
641
656
},
657
+ {
658
+ MetricDescriptor : & metricspb.MetricDescriptor {
659
+ Name : "system.network.packets" ,
660
+ Description : "The number of packets transferred" ,
661
+ Type : metricspb .MetricDescriptor_GAUGE_INT64 ,
662
+ LabelKeys : []* metricspb.LabelKey {
663
+ {Key : "direction" },
664
+ {Key : "device" },
665
+ {Key : "host" },
666
+ {Key : "kubernetes_node" },
667
+ {Key : "kubernetes_cluster" },
668
+ },
669
+ },
670
+ Timeseries : []* metricspb.TimeSeries {
671
+ {
672
+ StartTimestamp : & timestamppb.Timestamp {},
673
+ LabelValues : []* metricspb.LabelValue {{
674
+ Value : "receive" ,
675
+ HasValue : true ,
676
+ }, {
677
+ Value : "eth0" ,
678
+ HasValue : true ,
679
+ }, {
680
+ Value : "host0" ,
681
+ HasValue : true ,
682
+ }, {
683
+ Value : "node0" ,
684
+ HasValue : true ,
685
+ }, {
686
+ Value : "cluster0" ,
687
+ HasValue : true ,
688
+ }},
689
+ Points : []* metricspb.Point {{
690
+ Timestamp : & timestamppb.Timestamp {
691
+ Seconds : 1596000000 ,
692
+ },
693
+ Value : & metricspb.Point_Int64Value {
694
+ Int64Value : 200 ,
695
+ },
696
+ }},
697
+ },
698
+ {
699
+ StartTimestamp : & timestamppb.Timestamp {},
700
+ LabelValues : []* metricspb.LabelValue {{
701
+ Value : "receive" ,
702
+ HasValue : true ,
703
+ }, {
704
+ Value : "eth1" ,
705
+ HasValue : true ,
706
+ }, {
707
+ Value : "host0" ,
708
+ HasValue : true ,
709
+ }, {
710
+ Value : "node0" ,
711
+ HasValue : true ,
712
+ }, {
713
+ Value : "cluster0" ,
714
+ HasValue : true ,
715
+ }},
716
+ Points : []* metricspb.Point {{
717
+ Timestamp : & timestamppb.Timestamp {
718
+ Seconds : 1596000000 ,
719
+ },
720
+ Value : & metricspb.Point_Int64Value {
721
+ Int64Value : 150 ,
722
+ },
723
+ }},
724
+ },
725
+ },
726
+ },
642
727
{
643
728
MetricDescriptor : & metricspb.MetricDescriptor {
644
729
Name : "container.memory.working_set" ,
0 commit comments