Bug 1479510: Added a telemetry probe that records failed rsdparsa parsings, r=dminor

Added a telemetry probe that records failed rsdparsa parsings and whether the sipcc result contains errors.

MozReview-Commit-ID: BHfDRy8MyfZ

--HG--
extra : rebase_source : 9b03f1a8d0655926af1e561cc27e5549490616b2
This commit is contained in:
Johannes Willbold 2018-07-30 10:38:35 -07:00
parent 33e48d218b
commit 0ee54d4592
3 changed files with 27 additions and 7 deletions

View File

@ -1295,13 +1295,6 @@ nsresult
JsepSessionImpl::ParseSdp(const std::string& sdp, UniquePtr<Sdp>* parsedp)
{
UniquePtr<Sdp> parsed = mSipccParser.Parse(sdp);
if (mRunRustParser) {
UniquePtr<Sdp> rustParsed = mRsdparsaParser.Parse(sdp);
if (mRunSdpComparer) {
ParsingResultComparer comparer;
comparer.Compare(*rustParsed, *parsed, sdp);
}
}
if (!parsed) {
std::string error = "Failed to parse SDP: ";
mSdpHelper.appendSdpParseErrors(mSipccParser.GetParseErrors(), &error);
@ -1309,6 +1302,18 @@ JsepSessionImpl::ParseSdp(const std::string& sdp, UniquePtr<Sdp>* parsedp)
return NS_ERROR_INVALID_ARG;
}
if (mRunRustParser) {
UniquePtr<Sdp> rustParsed = mRsdparsaParser.Parse(sdp);
if (mRunSdpComparer) {
ParsingResultComparer comparer;
if (rustParsed) {
comparer.Compare(*rustParsed, *parsed, sdp);
} else {
comparer.TrackRustParsingFailed(mSipccParser.GetParseErrors().size());
}
}
}
// Verify that the JSEP rules for all SDP are followed
if (!parsed->GetMediaSectionCount()) {
JSEP_SET_ERROR("Description has no media sections");

View File

@ -247,6 +247,20 @@ ParsingResultComparer::CompareAttrLists(const SdpAttributeList& rustAttrlist,
return result;
}
void
ParsingResultComparer::TrackRustParsingFailed(size_t sipccErrorCount) const {
if (sipccErrorCount) {
Telemetry::ScalarAdd(Telemetry::ScalarID::WEBRTC_SDP_PARSER_DIFF,
NS_LITERAL_STRING("rsdparsa_failed__sipcc_has_errors"),
1);
} else {
Telemetry::ScalarAdd(Telemetry::ScalarID::WEBRTC_SDP_PARSER_DIFF,
NS_LITERAL_STRING("rsdparsa_failed__sipcc_succeeded"),
1);
}
}
std::vector<std::string>
SplitLines(const std::string& sdp)
{

View File

@ -30,6 +30,7 @@ public:
bool CompareAttrLists(const SdpAttributeList& rustAttrlist,
const SdpAttributeList& sipccAttrlist,
int level) const;
void TrackRustParsingFailed(size_t sipccErrorCount) const;
private: