public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } ExecutionSignature that = (ExecutionSignature)o; if (!CommandName.Equals(that.CommandName)) { return(false); } if (!Eventcounts.Equals(that.Eventcounts)) { return(false); } return(!(_cacheKey != null ? !_cacheKey.Equals(that._cacheKey) : that._cacheKey != null)); }
private static void ConvertExecutionToJson(JsonTextWriter json, ExecutionSignature executionSignature, List <int> latencies) { json.WriteStartObject(); json.WriteStringField("name", executionSignature.CommandName); json.WriteArrayFieldStart("events"); ExecutionResult.EventCounts eventCounts = executionSignature.Eventcounts; foreach (HystrixEventType eventType in HystrixEventTypeHelper.Values) { if (!eventType.Equals(HystrixEventType.COLLAPSED)) { if (eventCounts.Contains(eventType)) { int eventCount = eventCounts.GetCount(eventType); if (eventCount > 1) { json.WriteStartObject(); json.WriteStringField("name", eventType.ToString()); json.WriteIntegerField("count", eventCount); json.WriteEndObject(); } else { json.WriteValue(eventType.ToString()); } } } } json.WriteEndArray(); json.WriteArrayFieldStart("latencies"); foreach (int latency in latencies) { json.WriteValue(latency); } json.WriteEndArray(); if (executionSignature.CachedCount > 0) { json.WriteIntegerField("cached", executionSignature.CachedCount); } if (executionSignature.Eventcounts.Contains(HystrixEventType.COLLAPSED)) { json.WriteObjectFieldStart("collapsed"); json.WriteStringField("name", executionSignature.CollapserKey.Name); json.WriteIntegerField("count", executionSignature.CollapserBatchSize); json.WriteEndObject(); } json.WriteEndObject(); }