private ExecutionSignature(IHystrixCommandKey commandKey, ExecutionResult.EventCounts eventCounts, string cacheKey, int cachedCount, IHystrixCollapserKey collapserKey, int collapserBatchSize)
 {
     this.CommandName        = commandKey.Name;
     this.Eventcounts        = eventCounts;
     this._cacheKey          = cacheKey;
     this.CachedCount        = cachedCount;
     this.CollapserKey       = collapserKey;
     this.CollapserBatchSize = collapserBatchSize;
 }
        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();
        }