Esempio n. 1
0
        private static void SerializeUtilization(JsonTextWriter json, HystrixUtilization utilization)
        {
            json.WriteStartObject();
            json.WriteStringField("type", "HystrixUtilization");
            json.WriteObjectFieldStart("commands");
            foreach (var entry in utilization.CommandUtilizationMap)
            {
                IHystrixCommandKey        key = entry.Key;
                HystrixCommandUtilization commandUtilization = entry.Value;
                WriteCommandUtilizationJson(json, key, commandUtilization);
            }

            json.WriteEndObject();

            json.WriteObjectFieldStart("threadpools");
            foreach (var entry in utilization.ThreadPoolUtilizationMap)
            {
                IHystrixThreadPoolKey        threadPoolKey         = entry.Key;
                HystrixThreadPoolUtilization threadPoolUtilization = entry.Value;
                WriteThreadPoolUtilizationJson(json, threadPoolKey, threadPoolUtilization);
            }

            json.WriteEndObject();
            json.WriteEndObject();
        }
Esempio n. 2
0
 private static void WriteThreadPoolUtilizationJson(JsonTextWriter json, IHystrixThreadPoolKey threadPoolKey, HystrixThreadPoolUtilization utilization)
 {
     json.WriteObjectFieldStart(threadPoolKey.Name);
     json.WriteIntegerField("activeCount", utilization.CurrentActiveCount);
     json.WriteIntegerField("queueSize", utilization.CurrentQueueSize);
     json.WriteIntegerField("corePoolSize", utilization.CurrentCorePoolSize);
     json.WriteIntegerField("poolSize", utilization.CurrentPoolSize);
     json.WriteEndObject();
 }