Commit 52bd89d4 authored by Nick Craver's avatar Nick Craver

Cleanup: CommandTrace

parent 819a608e
...@@ -23,23 +23,23 @@ internal CommandTrace(long uniqueId, long time, long duration, RedisValue[] argu ...@@ -23,23 +23,23 @@ internal CommandTrace(long uniqueId, long time, long duration, RedisValue[] argu
/// <summary> /// <summary>
/// The array composing the arguments of the command. /// The array composing the arguments of the command.
/// </summary> /// </summary>
public RedisValue[] Arguments { get; private set; } public RedisValue[] Arguments { get; }
/// <summary> /// <summary>
/// The amount of time needed for its execution /// The amount of time needed for its execution
/// </summary> /// </summary>
public TimeSpan Duration { get; private set; } public TimeSpan Duration { get; }
/// <summary> /// <summary>
/// The time at which the logged command was processed. /// The time at which the logged command was processed.
/// </summary> /// </summary>
public DateTime Time { get; private set; } public DateTime Time { get; }
/// <summary> /// <summary>
/// A unique progressive identifier for every slow log entry. /// A unique progressive identifier for every slow log entry.
/// </summary> /// </summary>
/// <remarks>The entry's unique ID can be used in order to avoid processing slow log entries multiple times (for instance you may have a script sending you an email alert for every new slow log entry). The ID is never reset in the course of the Redis server execution, only a server restart will reset it.</remarks> /// <remarks>The entry's unique ID can be used in order to avoid processing slow log entries multiple times (for instance you may have a script sending you an email alert for every new slow log entry). The ID is never reset in the course of the Redis server execution, only a server restart will reset it.</remarks>
public long UniqueId { get; private set; } public long UniqueId { get; }
/// <summary> /// <summary>
/// Deduces a link to the redis documentation about the specified command /// Deduces a link to the redis documentation about the specified command
...@@ -54,7 +54,6 @@ public string GetHelpUrl() ...@@ -54,7 +54,6 @@ public string GetHelpUrl()
if (Arguments.Length > 1) if (Arguments.Length > 1)
{ {
switch (encoded0) switch (encoded0)
{ {
case "script": case "script":
...@@ -81,10 +80,8 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes ...@@ -81,10 +80,8 @@ protected override bool SetResultCore(PhysicalConnection connection, Message mes
CommandTrace[] arr = new CommandTrace[parts.Length]; CommandTrace[] arr = new CommandTrace[parts.Length];
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{ {
var subParts = parts[i].GetItems(); var subParts = parts[i].GetItems();
long uniqueid, time, duration; if (!subParts[0].TryGetInt64(out long uniqueid) || !subParts[1].TryGetInt64(out long time) || !subParts[2].TryGetInt64(out long duration))
if (!subParts[0].TryGetInt64(out uniqueid) || !subParts[1].TryGetInt64(out time) || !subParts[2].TryGetInt64(out duration))
return false; return false;
arr[i] = new CommandTrace(uniqueid, time, duration, subParts[3].GetItemsAsValues()); arr[i] = new CommandTrace(uniqueid, time, duration, subParts[3].GetItemsAsValues());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment