private static QueryLockInfo GetQueryLockInfo(LongLockParser parser, XmlRow row) { var info = parser.Parse(row.XML); string durationStr = GetDataValue(info, "duration"); long.TryParse(durationStr, out long duration); eventDataValueBlockedprocessreport processesInfo = GetDataItem(info, "blocked_process").value.blockedprocessreport; string blockedText = processesInfo.blockedprocess.process.inputbuf; string blockerText = processesInfo.blockingprocess.process.inputbuf; return(new QueryLockInfo { TimeStamp = info.timestamp, Duration = duration, LockMode = GetDataItem(info, "lock_mode")?.text, DatabaseName = GetDbName(info), Blocked = new Proess { Text = blockedText.ExtractLocksSqlText() }, Blocker = new Proess { Text = blockerText.ExtractLocksSqlText() }, SourceXml = row.XML }); }
public IEnumerable <QueryLockInfo> ReadLongLockEvents(string file) { var parser = new LongLockParser(); foreach (XmlRow row in ReadEventData(file)) { QueryLockInfo info; try { info = GetQueryLockInfo(parser, row); } catch (Exception e) { _logger.LogError(new EventId(1), e, "Error while parsing long locks xml record: {0}", row.XML); continue; } yield return(info); } }