Skip to content

Commit

Permalink
Import changes.
Browse files Browse the repository at this point in the history
  - 7ca32303bc8a492bfea78795f0b4f6e16249c059

GitOrigin-RevId: 7ca32303bc8a492bfea78795f0b4f6e16249c059
  • Loading branch information
Aalyria Technologies, Inc committed Dec 13, 2024
1 parent 8590658 commit b0992ed
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 126 deletions.
8 changes: 4 additions & 4 deletions agent/telemetry/netlink/container_test/netlink_telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ func main() {
firstStats := firstReport.GetInterfaceMetrics()[0].GetStandardInterfaceStatisticsDataPoints()[0]
secondStats := secondReport.GetInterfaceMetrics()[0].GetStandardInterfaceStatisticsDataPoints()[0]

if secondStats.TxPackets > firstStats.TxPackets &&
secondStats.RxPackets > firstStats.RxPackets &&
secondStats.TxBytes > firstStats.TxBytes &&
secondStats.RxBytes > firstStats.RxBytes {
if secondStats.GetTxPackets() > firstStats.GetTxPackets() &&
secondStats.GetRxPackets() > firstStats.GetRxPackets() &&
secondStats.GetTxBytes() > firstStats.GetTxBytes() &&
secondStats.GetRxBytes() > firstStats.GetRxBytes() {
fmt.Printf("PASS: Byte and packet counters all went up")
} else {
fmt.Printf("FAIL: Byte and packet counters did not all go up")
Expand Down
20 changes: 10 additions & 10 deletions agent/telemetry/netlink/netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ func (rg *reportGenerator) GenerateReport(ctx context.Context, nodeID string) (*
}

interfaceMetrics = append(interfaceMetrics, &telemetrypb.InterfaceMetrics{
InterfaceId: string(textNetIfaceID),
InterfaceId: proto.String(string(textNetIfaceID)),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(ts),
Value: netlinkOperStateToTelemetryOperState(attrs.OperState),
Value: netlinkOperStateToTelemetryOperState(attrs.OperState).Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(ts),
RxPackets: int64(stats.RxPackets),
TxPackets: int64(stats.TxPackets),
RxBytes: int64(stats.RxBytes),
TxBytes: int64(stats.TxBytes),
TxErrors: int64(stats.TxErrors),
RxErrors: int64(stats.RxErrors),
RxDropped: int64(stats.RxDropped),
TxDropped: int64(stats.TxDropped),
RxPackets: proto.Int64(int64(stats.RxPackets)),
TxPackets: proto.Int64(int64(stats.TxPackets)),
RxBytes: proto.Int64(int64(stats.RxBytes)),
TxBytes: proto.Int64(int64(stats.TxBytes)),
TxErrors: proto.Int64(int64(stats.TxErrors)),
RxErrors: proto.Int64(int64(stats.RxErrors)),
RxDropped: proto.Int64(int64(stats.RxDropped)),
TxDropped: proto.Int64(int64(stats.TxDropped)),
}},
})
}
Expand Down
154 changes: 77 additions & 77 deletions agent/telemetry/netlink/netlink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,24 @@ func TestNetlink(t *testing.T) {
nodeID: "serenity",
wantMetrics: &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("serenity"),
InterfaceId: proto.String("cargo-bay-door"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_UP,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_UP.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(clock.Now()),
TxPackets: 1,
RxPackets: 2,
TxBytes: 3,
RxBytes: 4,
TxDropped: 5,
RxDropped: 6,
TxErrors: 7,
RxErrors: 8,
TxPackets: proto.Int64(1),
RxPackets: proto.Int64(2),
TxBytes: proto.Int64(3),
RxBytes: proto.Int64(4),
TxDropped: proto.Int64(5),
RxDropped: proto.Int64(6),
TxErrors: proto.Int64(7),
RxErrors: proto.Int64(8),
}},
}},
},
Expand Down Expand Up @@ -161,67 +161,67 @@ func TestNetlink(t *testing.T) {
nodeID: "ISS",
wantMetrics: &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("ISS"),
InterfaceId: proto.String("gemini"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_DOWN,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_DOWN.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(clock.Now()),
TxPackets: 1,
RxPackets: 2,
TxBytes: 3,
RxBytes: 4,
TxDropped: 5,
RxDropped: 6,
TxErrors: 7,
RxErrors: 8,
TxPackets: proto.Int64(1),
RxPackets: proto.Int64(2),
TxBytes: proto.Int64(3),
RxBytes: proto.Int64(4),
TxDropped: proto.Int64(5),
RxDropped: proto.Int64(6),
TxErrors: proto.Int64(7),
RxErrors: proto.Int64(8),
}},
}, {
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("ISS"),
InterfaceId: proto.String("apollo"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_LOWER_LAYER_DOWN,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_LOWER_LAYER_DOWN.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{
{
Time: timestamppb.New(clock.Now()),
TxPackets: 10,
RxPackets: 20,
TxBytes: 30,
RxBytes: 40,
TxDropped: 50,
RxDropped: 60,
TxErrors: 70,
RxErrors: 80,
TxPackets: proto.Int64(10),
RxPackets: proto.Int64(20),
TxBytes: proto.Int64(30),
RxBytes: proto.Int64(40),
TxDropped: proto.Int64(50),
RxDropped: proto.Int64(60),
TxErrors: proto.Int64(70),
RxErrors: proto.Int64(80),
},
},
}, {
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("ISS"),
InterfaceId: proto.String("IDSS"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_DORMANT,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_DORMANT.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{
{
Time: timestamppb.New(clock.Now()),
TxPackets: 100,
RxPackets: 200,
TxBytes: 300,
RxBytes: 400,
TxDropped: 500,
RxDropped: 600,
TxErrors: 700,
RxErrors: 800,
TxPackets: proto.Int64(100),
RxPackets: proto.Int64(200),
TxBytes: proto.Int64(300),
RxBytes: proto.Int64(400),
TxDropped: proto.Int64(500),
RxDropped: proto.Int64(600),
TxErrors: proto.Int64(700),
RxErrors: proto.Int64(800),
},
},
}},
Expand Down Expand Up @@ -250,24 +250,24 @@ func TestNetlink(t *testing.T) {
nodeID: "enterprise",
wantMetrics: &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("enterprise"),
InterfaceId: proto.String("dry-dock"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_TESTING,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_TESTING.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(clock.Now()),
TxPackets: 1,
RxPackets: 2,
TxBytes: 3,
RxBytes: 4,
TxDropped: 5,
RxDropped: 6,
TxErrors: 7,
RxErrors: 8,
TxPackets: proto.Int64(1),
RxPackets: proto.Int64(2),
TxBytes: proto.Int64(3),
RxBytes: proto.Int64(4),
TxDropped: proto.Int64(5),
RxDropped: proto.Int64(6),
TxErrors: proto.Int64(7),
RxErrors: proto.Int64(8),
}},
}},
},
Expand Down Expand Up @@ -296,24 +296,24 @@ func TestNetlink(t *testing.T) {
nodeID: "enterprise",
wantMetrics: &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("enterprise"),
InterfaceId: proto.String("dry-dock"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_UNKNOWN,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_UNKNOWN.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(clock.Now()),
TxPackets: 1,
RxPackets: 2,
TxBytes: 3,
RxBytes: 4,
TxDropped: 5,
RxDropped: 6,
TxErrors: 7,
RxErrors: 8,
TxPackets: proto.Int64(1),
RxPackets: proto.Int64(2),
TxBytes: proto.Int64(3),
RxBytes: proto.Int64(4),
TxDropped: proto.Int64(5),
RxDropped: proto.Int64(6),
TxErrors: proto.Int64(7),
RxErrors: proto.Int64(8),
}},
}},
},
Expand Down Expand Up @@ -344,24 +344,24 @@ func TestNetlink(t *testing.T) {
nodeID: "enterprise",
wantMetrics: &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textNetworkIfaceID(&commonpb.NetworkInterfaceId{
InterfaceId: proto.String(textNetworkIfaceID(&commonpb.NetworkInterfaceId{
NodeId: proto.String("enterprise"),
InterfaceId: proto.String("dry-dock"),
}),
})),
OperationalStateDataPoints: []*telemetrypb.IfOperStatusDataPoint{{
Time: timestamppb.New(clock.Now()),
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_NOT_PRESENT,
Value: telemetrypb.IfOperStatus_IF_OPER_STATUS_NOT_PRESENT.Enum(),
}},
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
Time: timestamppb.New(clock.Now()),
TxPackets: 1,
RxPackets: 2,
TxBytes: 3,
RxBytes: 4,
TxDropped: 5,
RxDropped: 6,
TxErrors: 7,
RxErrors: 8,
TxPackets: proto.Int64(1),
RxPackets: proto.Int64(2),
TxBytes: proto.Int64(3),
RxBytes: proto.Int64(4),
TxDropped: proto.Int64(5),
RxDropped: proto.Int64(6),
TxErrors: proto.Int64(7),
RxErrors: proto.Int64(8),
}},
}},
},
Expand Down
6 changes: 3 additions & 3 deletions agent/telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func TestRelaysMetricsFromDriverToController(t *testing.T) {

servedReport := &telemetrypb.ExportMetricsRequest{
InterfaceMetrics: []*telemetrypb.InterfaceMetrics{{
InterfaceId: textPBIfaceID(t, "foobar", "lo0"),
InterfaceId: proto.String(textPBIfaceID(t, "foobar", "lo0")),
StandardInterfaceStatisticsDataPoints: []*telemetrypb.StandardInterfaceStatisticsDataPoint{{
TxBytes: 1,
RxBytes: 12,
TxBytes: proto.Int64(1),
RxBytes: proto.Int64(12),
}},
}},
}
Expand Down
Loading

0 comments on commit b0992ed

Please sign in to comment.