Skip to content

Commit

Permalink
SQLNA Updates
Browse files Browse the repository at this point in the history
Log ConnectionID and ActivityID
Fix ETL date issue
Minor fixes
  • Loading branch information
Malcolm-Stewart committed Sep 21, 2023
1 parent e3aa4ca commit 795439e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions SQL_Network_Analyzer/SQLNA/ConversationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public class ConversationData // - constructed in GetI
public string serverInstance = null; // - set in GetClientPreloginInfo
public uint processID = 0;
public uint threadID = 0; // - set in GetClientPreloginInfo
public Guid connectionPeerID = Guid.Empty; // - set in GetClientPreloginInfo
public Guid peeractivityid = Guid.Empty;
public long peeractivityseq = 0; // ActivitySequence
public Guid connectionID = Guid.Empty; // - set in GetClientPreloginInfo
public Guid activityID = Guid.Empty; // - set in GetClientPreloginInfo
public long activitySequence = 0; // - set in GetClientPreloginInfo
public uint preloginFrameNumber = 0;

// Login Error and Delay Stats
Expand Down
2 changes: 1 addition & 1 deletion SQL_Network_Analyzer/SQLNA/ETLFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private void TraceEvent_EventCallback(TraceEventInterop.EVENT_RECORD* rawData)
}
else
{
f.ticks = m_sessionStartTime.Ticks + ((long)(((rawData->EventHeader).TimeStamp - FirstTimeStamp) * (double)(100000000 / m_QPCFreq)));
f.ticks = m_sessionStartTime.Ticks + ((long)(((rawData->EventHeader).TimeStamp - FirstTimeStamp) * ((double)10000000.0 / m_QPCFreq))); // 10-million (seven 0's)
}
userData = new byte[rawData->UserDataLength - arrayOffset];
var x = ((byte*)rawData->UserData);
Expand Down
6 changes: 3 additions & 3 deletions SQL_Network_Analyzer/SQLNA/OutputText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3776,9 +3776,9 @@ private static void OutputStats(NetworkTrace Trace)
(c.TTLCountIn == 0 ? "" : (c.TTLSumIn / c.TTLCountIn).ToString()) + "," +
(c.TTLCountIn == 0 ? "" : c.minTTLHopsIn.ToString()) + "," +
(c.preloginFrameNumber) + "," +
(c.connectionPeerID == Guid.Empty ? "" : c.connectionPeerID.ToString().ToUpper()) + "," +
(c.peeractivityid == Guid.Empty ? "" : c.peeractivityid.ToString().ToUpper()) + "," +
c.peeractivityseq + "," +
(c.connectionID == Guid.Empty ? "" : c.connectionID.ToString().ToUpper()) + "," +
(c.activityID == Guid.Empty ? "" : c.activityID.ToString().ToUpper()) + "," +
c.activitySequence + "," +
ServerName + "," +
(c.serverInstance == null ? "" : c.serverInstance) + "," +
ServerVersion + "," +
Expand Down
3 changes: 3 additions & 0 deletions SQL_Network_Analyzer/SQLNA/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ public static void ParseNextProtocol(uint ProtocolNumber, byte[] b, int offset,
{
switch (ProtocolNumber)
{
case 0x0001: // ICMP - ignore and do not log
break;
case 0x0006: // TCP
ParseTCPFrame(b, offset, t, f);
break;
Expand All @@ -402,6 +404,7 @@ public static void ParseNextProtocol(uint ProtocolNumber, byte[] b, int offset,
ParseIPV4Frame(b, offset, t, f);
break;
case 0x0806: // ARP - ignore and do not log
case 0x8035: // RARP - ignore and do not log - Reverse ARP
break;
case 0x8100: // 802.1Q
Parse8021QFrame(b, offset, t, f);
Expand Down
4 changes: 2 additions & 2 deletions SQL_Network_Analyzer/SQLNA/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.2129.0")]
[assembly: AssemblyFileVersion("1.5.2129.0")]
[assembly: AssemblyVersion("1.5.2143.0")]
[assembly: AssemblyFileVersion("1.5.2143.0")]
7 changes: 3 additions & 4 deletions SQL_Network_Analyzer/SQLNA/TDSParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,13 @@ private static void GetClientPreloginInfo(byte[] tdsPayLoad, ConversationData co
{
byte[] guidBytes = new byte[16];
Array.Copy(tdsPayLoad, 8 + offset, guidBytes, 0, 16);
conv.connectionPeerID = new Guid(guidBytes);
conv.connectionID = new Guid(guidBytes);

Array.Copy(tdsPayLoad, (8 + offset + 16), guidBytes, 0, 16);
conv.peeractivityid = new Guid(guidBytes);
conv.activityID = new Guid(guidBytes);

//peer_activity_seq
conv.peeractivityseq = utility.ReadUInt32(tdsPayLoad, (8 + offset + 32));

conv.activitySequence = utility.ReadUInt32(tdsPayLoad, (8 + offset + 32));
}
break;
default:
Expand Down

0 comments on commit 795439e

Please sign in to comment.