From f7bc5429b8a6080475c123a3f3bf45bf7020471b Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Wed, 21 Sep 2022 14:38:40 +0200 Subject: [PATCH] [PCLF] Fix test case for network metrics exported through new API Bug: b/246095034 Change-Id: Ie3415c7119d5554c0f39670de199b0a545949121 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276266 Reviewed-by: Mirko Bonadei Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/main@{#38158} --- .../e2e/network_quality_metrics_reporter.cc | 32 ++++---- ..._based_network_quality_metrics_reporter.cc | 78 ++++++++++--------- 2 files changed, 61 insertions(+), 49 deletions(-) diff --git a/test/pc/e2e/network_quality_metrics_reporter.cc b/test/pc/e2e/network_quality_metrics_reporter.cc index 93d5438f0f..d073b15437 100644 --- a/test/pc/e2e/network_quality_metrics_reporter.cc +++ b/test/pc/e2e/network_quality_metrics_reporter.cc @@ -139,35 +139,39 @@ void NetworkQualityMetricsReporter::ReportStats( ReportResult("sent_packets_loss", network_label, packet_loss, "unitless"); } else { metrics_logger_->LogSingleValueMetric( - "bytes_sent", network_label, stats->BytesSent().bytes(), Unit::kBytes, + "bytes_sent", GetTestCaseName(network_label), + stats->BytesSent().bytes(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_sent", network_label, stats->PacketsSent(), Unit::kUnitless, - ImprovementDirection::kNeitherIsBetter); + "packets_sent", GetTestCaseName(network_label), stats->PacketsSent(), + Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "average_send_rate", network_label, + "average_send_rate", GetTestCaseName(network_label), stats->PacketsSent() >= 2 ? stats->AverageSendRate().kbps() : 0, Unit::kKilobitsPerSecond, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "bytes_discarded_no_receiver", network_label, + "bytes_discarded_no_receiver", GetTestCaseName(network_label), stats->BytesDropped().bytes(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_discarded_no_receiver", network_label, stats->PacketsDropped(), - Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); + "packets_discarded_no_receiver", GetTestCaseName(network_label), + stats->PacketsDropped(), Unit::kUnitless, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "bytes_received", network_label, stats->BytesReceived().bytes(), - Unit::kBytes, ImprovementDirection::kNeitherIsBetter); + "bytes_received", GetTestCaseName(network_label), + stats->BytesReceived().bytes(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_received", network_label, stats->PacketsReceived(), - Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); + "packets_received", GetTestCaseName(network_label), + stats->PacketsReceived(), Unit::kUnitless, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "average_receive_rate", network_label, + "average_receive_rate", GetTestCaseName(network_label), stats->PacketsReceived() >= 2 ? stats->AverageReceiveRate().kbps() : 0, Unit::kKilobitsPerSecond, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "sent_packets_loss", network_label, packet_loss, Unit::kUnitless, - ImprovementDirection::kNeitherIsBetter); + "sent_packets_loss", GetTestCaseName(network_label), packet_loss, + Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); } } diff --git a/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc b/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc index a4e046e540..bc7c968026 100644 --- a/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc +++ b/test/pc/e2e/stats_based_network_quality_metrics_reporter.cc @@ -271,44 +271,48 @@ void StatsBasedNetworkQualityMetricsReporter::ReportStats( ReportResult("sent_packets_loss", pc_label, packet_loss, "unitless"); } else { metrics_logger_->LogSingleValueMetric( - "bytes_discarded_no_receiver", pc_label, + "bytes_discarded_no_receiver", GetTestCaseName(pc_label), network_layer_stats.stats->BytesDropped().bytes(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_discarded_no_receiver", pc_label, + "packets_discarded_no_receiver", GetTestCaseName(pc_label), network_layer_stats.stats->PacketsDropped(), Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "payload_bytes_received", pc_label, pc_stats.payload_received.bytes(), - Unit::kBytes, ImprovementDirection::kNeitherIsBetter); + "payload_bytes_received", GetTestCaseName(pc_label), + pc_stats.payload_received.bytes(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "payload_bytes_sent", pc_label, pc_stats.payload_sent.bytes(), - Unit::kBytes, ImprovementDirection::kNeitherIsBetter); + "payload_bytes_sent", GetTestCaseName(pc_label), + pc_stats.payload_sent.bytes(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "bytes_sent", pc_label, pc_stats.total_sent.bytes(), Unit::kBytes, - ImprovementDirection::kNeitherIsBetter); + "bytes_sent", GetTestCaseName(pc_label), pc_stats.total_sent.bytes(), + Unit::kBytes, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_sent", pc_label, pc_stats.packets_sent, Unit::kUnitless, - ImprovementDirection::kNeitherIsBetter); + "packets_sent", GetTestCaseName(pc_label), pc_stats.packets_sent, + Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "average_send_rate", pc_label, + "average_send_rate", GetTestCaseName(pc_label), (pc_stats.total_sent / (end_time - start_time_)).kbps(), Unit::kKilobitsPerSecond, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "bytes_received", pc_label, pc_stats.total_received.bytes(), - Unit::kBytes, ImprovementDirection::kNeitherIsBetter); + "bytes_received", GetTestCaseName(pc_label), + pc_stats.total_received.bytes(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "packets_received", pc_label, pc_stats.packets_received, - Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); + "packets_received", GetTestCaseName(pc_label), + pc_stats.packets_received, Unit::kUnitless, + ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "average_receive_rate", pc_label, + "average_receive_rate", GetTestCaseName(pc_label), (pc_stats.total_received / (end_time - start_time_)).kbps(), Unit::kKilobitsPerSecond, ImprovementDirection::kNeitherIsBetter); metrics_logger_->LogSingleValueMetric( - "sent_packets_loss", pc_label, packet_loss, Unit::kUnitless, - ImprovementDirection::kNeitherIsBetter); + "sent_packets_loss", GetTestCaseName(pc_label), packet_loss, + Unit::kUnitless, ImprovementDirection::kNeitherIsBetter); } } @@ -361,8 +365,9 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( stats.stats->SentPacketsSizeCounter(), "sizeInBytes"); } else { metrics_logger_->LogMetric( - "sent_packets_size", peer_name, stats.stats->SentPacketsSizeCounter(), - Unit::kBytes, ImprovementDirection::kNeitherIsBetter); + "sent_packets_size", GetTestCaseName(peer_name), + stats.stats->SentPacketsSizeCounter(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); } } if (!stats.stats->ReceivedPacketsSizeCounter().IsEmpty()) { @@ -370,10 +375,10 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( ReportResult("received_packets_size", peer_name, stats.stats->ReceivedPacketsSizeCounter(), "sizeInBytes"); } else { - metrics_logger_->LogMetric("received_packets_size", peer_name, - stats.stats->ReceivedPacketsSizeCounter(), - Unit::kBytes, - ImprovementDirection::kNeitherIsBetter); + metrics_logger_->LogMetric( + "received_packets_size", GetTestCaseName(peer_name), + stats.stats->ReceivedPacketsSizeCounter(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); } } if (!stats.stats->DroppedPacketsSizeCounter().IsEmpty()) { @@ -381,10 +386,10 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( ReportResult("dropped_packets_size", peer_name, stats.stats->DroppedPacketsSizeCounter(), "sizeInBytes"); } else { - metrics_logger_->LogMetric("dropped_packets_size", peer_name, - stats.stats->DroppedPacketsSizeCounter(), - Unit::kBytes, - ImprovementDirection::kNeitherIsBetter); + metrics_logger_->LogMetric( + "dropped_packets_size", GetTestCaseName(peer_name), + stats.stats->DroppedPacketsSizeCounter(), Unit::kBytes, + ImprovementDirection::kNeitherIsBetter); } } if (!stats.stats->SentPacketsQueueWaitTimeUs().IsEmpty()) { @@ -392,10 +397,10 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( ReportResult("sent_packets_queue_wait_time_us", peer_name, stats.stats->SentPacketsQueueWaitTimeUs(), "unitless"); } else { - metrics_logger_->LogMetric("sent_packets_queue_wait_time_us", peer_name, - stats.stats->SentPacketsQueueWaitTimeUs(), - Unit::kUnitless, - ImprovementDirection::kNeitherIsBetter); + metrics_logger_->LogMetric( + "sent_packets_queue_wait_time_us", GetTestCaseName(peer_name), + stats.stats->SentPacketsQueueWaitTimeUs(), Unit::kUnitless, + ImprovementDirection::kNeitherIsBetter); } } @@ -422,7 +427,8 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( stats.stats->SentPacketsSizeCounter(), "sizeInBytes"); } else { metrics_logger_->LogMetric( - "sent_packets_size", peer_name + "/" + entry.first.ToString(), + "sent_packets_size", + GetTestCaseName(peer_name + "/" + entry.first.ToString()), stats.stats->SentPacketsSizeCounter(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); } @@ -454,7 +460,8 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( stats.stats->ReceivedPacketsSizeCounter(), "sizeInBytes"); } else { metrics_logger_->LogMetric( - "received_packets_size", peer_name + "/" + entry.first.ToString(), + "received_packets_size", + GetTestCaseName(peer_name + "/" + entry.first.ToString()), stats.stats->ReceivedPacketsSizeCounter(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); } @@ -466,7 +473,8 @@ void StatsBasedNetworkQualityMetricsReporter::LogNetworkLayerStats( stats.stats->DroppedPacketsSizeCounter(), "sizeInBytes"); } else { metrics_logger_->LogMetric( - "dropped_packets_size", peer_name + "/" + entry.first.ToString(), + "dropped_packets_size", + GetTestCaseName(peer_name + "/" + entry.first.ToString()), stats.stats->DroppedPacketsSizeCounter(), Unit::kBytes, ImprovementDirection::kNeitherIsBetter); }