private static void SerializeConfiguration(JsonTextWriter writer, HystrixConfiguration config)
        {

            writer.WriteStartObject();
            writer.WriteStringField("type", "HystrixConfig");
            writer.WriteObjectFieldStart("commands");
            foreach (var entry in config.CommandConfig)
            {
                IHystrixCommandKey key = entry.Key;
                HystrixCommandConfiguration commandConfig = entry.Value;
                WriteCommandConfigJson(writer, key, commandConfig);

            }
            writer.WriteEndObject();

            writer.WriteObjectFieldStart("threadpools");
            foreach (var entry in config.ThreadPoolConfig)
            {
                IHystrixThreadPoolKey threadPoolKey = entry.Key;
                HystrixThreadPoolConfiguration threadPoolConfig = entry.Value;
                WriteThreadPoolConfigJson(writer, threadPoolKey, threadPoolConfig);
            }
            writer.WriteEndObject();

            writer.WriteObjectFieldStart("collapsers");
            foreach (var entry in config.CollapserConfig)
            {
                IHystrixCollapserKey collapserKey = entry.Key;
                HystrixCollapserConfiguration collapserConfig = entry.Value;
                WriteCollapserConfigJson(writer, collapserKey, collapserConfig);
            }
            writer.WriteEndObject();
            writer.WriteEndObject();

        }
Beispiel #2
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();
        }
Beispiel #3
0
        private static void WriteCommandData(HystrixDashboardStream.DashboardData data, IDiscoveryClient discoveryClient, List <string> jsonList)
        {
            try
            {
                var localService = discoveryClient?.GetLocalServiceInstance();

                foreach (HystrixCommandMetrics commandMetrics in data.CommandMetrics)
                {
                    using (StringWriter sw = new StringWriter())
                    {
                        using (JsonTextWriter writer = new JsonTextWriter(sw))
                        {
                            writer.WriteStartObject();
                            WriteLocalService(writer, localService);
                            writer.WriteObjectFieldStart("data");
                            WriteCommandMetrics(writer, commandMetrics, localService);
                            writer.WriteEndObject();
                            writer.WriteEndObject();
                        }

                        jsonList.Add(sw.ToString());
                    }
                }
            }
            catch (Exception)
            {
                // Log
            }
        }
 private static void WriteCollapserConfigJson(JsonTextWriter json, IHystrixCollapserKey collapserKey, HystrixCollapserConfiguration collapserConfig)
 {
     json.WriteObjectFieldStart(collapserKey.Name);
     json.WriteIntegerField("maxRequestsInBatch", collapserConfig.MaxRequestsInBatch);
     json.WriteIntegerField("timerDelayInMilliseconds", collapserConfig.TimerDelayInMilliseconds);
     json.WriteBooleanField("requestCacheEnabled", collapserConfig.IsRequestCacheEnabled);
     json.WriteObjectFieldStart("metrics");
     HystrixCollapserConfiguration.CollapserMetricsConfig metricsConfig = collapserConfig.CollapserMetricsConfiguration;
     json.WriteIntegerField("percentileBucketSizeInMilliseconds", metricsConfig.RollingPercentileBucketSizeInMilliseconds);
     json.WriteIntegerField("percentileBucketCount", metricsConfig.RollingCounterNumberOfBuckets);
     json.WriteBooleanField("percentileEnabled", metricsConfig.IsRollingPercentileEnabled);
     json.WriteIntegerField("counterBucketSizeInMilliseconds", metricsConfig.RollingCounterBucketSizeInMilliseconds);
     json.WriteIntegerField("counterBucketCount", metricsConfig.RollingCounterNumberOfBuckets);
     json.WriteEndObject();
     json.WriteEndObject();
 }
Beispiel #5
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();
 }
        private static void WriteCommandConfigJson(JsonTextWriter json, IHystrixCommandKey key, HystrixCommandConfiguration commandConfig)
        {
            json.WriteObjectFieldStart(key.Name);
            json.WriteStringField("threadPoolKey", commandConfig.ThreadPoolKey.Name);
            json.WriteStringField("groupKey", commandConfig.GroupKey.Name);
            json.WriteObjectFieldStart("execution");
            var executionConfig = commandConfig.ExecutionConfig;

            json.WriteStringField("isolationStrategy", executionConfig.IsolationStrategy.ToString());
            json.WriteStringField("threadPoolKeyOverride", executionConfig.ThreadPoolKeyOverride);
            json.WriteBooleanField("requestCacheEnabled", executionConfig.IsRequestCacheEnabled);
            json.WriteBooleanField("requestLogEnabled", executionConfig.IsRequestLogEnabled);
            json.WriteBooleanField("timeoutEnabled", executionConfig.IsTimeoutEnabled);
            json.WriteBooleanField("fallbackEnabled", executionConfig.IsFallbackEnabled);
            json.WriteIntegerField("timeoutInMilliseconds", executionConfig.TimeoutInMilliseconds);
            json.WriteIntegerField("semaphoreSize", executionConfig.SemaphoreMaxConcurrentRequests);
            json.WriteIntegerField("fallbackSemaphoreSize", executionConfig.FallbackMaxConcurrentRequest);
            json.WriteBooleanField("threadInterruptOnTimeout", executionConfig.IsThreadInterruptOnTimeout);
            json.WriteEndObject();
            json.WriteObjectFieldStart("metrics");
            var metricsConfig = commandConfig.MetricsConfig;

            json.WriteIntegerField("healthBucketSizeInMs", metricsConfig.HealthIntervalInMilliseconds);
            json.WriteIntegerField("percentileBucketSizeInMilliseconds", metricsConfig.RollingPercentileBucketSizeInMilliseconds);
            json.WriteIntegerField("percentileBucketCount", metricsConfig.RollingCounterNumberOfBuckets);
            json.WriteBooleanField("percentileEnabled", metricsConfig.IsRollingPercentileEnabled);
            json.WriteIntegerField("counterBucketSizeInMilliseconds", metricsConfig.RollingCounterBucketSizeInMilliseconds);
            json.WriteIntegerField("counterBucketCount", metricsConfig.RollingCounterNumberOfBuckets);
            json.WriteEndObject();
            json.WriteObjectFieldStart("circuitBreaker");
            var circuitBreakerConfig = commandConfig.CircuitBreakerConfig;

            json.WriteBooleanField("enabled", circuitBreakerConfig.IsEnabled);
            json.WriteBooleanField("isForcedOpen", circuitBreakerConfig.IsForceOpen);
            json.WriteBooleanField("isForcedClosed", circuitBreakerConfig.IsForceOpen);
            json.WriteIntegerField("requestVolumeThreshold", circuitBreakerConfig.RequestVolumeThreshold);
            json.WriteIntegerField("errorPercentageThreshold", circuitBreakerConfig.ErrorThresholdPercentage);
            json.WriteIntegerField("sleepInMilliseconds", circuitBreakerConfig.SleepWindowInMilliseconds);
            json.WriteEndObject();
            json.WriteEndObject();
        }
 private static void WriteThreadPoolConfigJson(JsonTextWriter json, IHystrixThreadPoolKey threadPoolKey, HystrixThreadPoolConfiguration threadPoolConfig)
 {
     json.WriteObjectFieldStart(threadPoolKey.Name);
     json.WriteIntegerField("coreSize", threadPoolConfig.CoreSize);
     json.WriteIntegerField("maximumSize", threadPoolConfig.MaximumSize);
     json.WriteIntegerField("maxQueueSize", threadPoolConfig.MaxQueueSize);
     json.WriteIntegerField("queueRejectionThreshold", threadPoolConfig.QueueRejectionThreshold);
     json.WriteIntegerField("keepAliveTimeInMinutes", threadPoolConfig.KeepAliveTimeInMinutes);
     json.WriteBooleanField("allowMaximumSizeToDivergeFromCoreSize", threadPoolConfig.AllowMaximumSizeToDivergeFromCoreSize);
     json.WriteIntegerField("counterBucketSizeInMilliseconds", threadPoolConfig.RollingCounterBucketSizeInMilliseconds);
     json.WriteIntegerField("counterBucketCount", threadPoolConfig.RollingCounterNumberOfBuckets);
     json.WriteEndObject();
 }
        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();
        }
Beispiel #9
0
        private static void WriteLocalService(JsonTextWriter writer, IServiceInstance localService)
        {
            writer.WriteObjectFieldStart("origin");
            writer.WriteStringField("host", localService?.Host);
            if (localService == null)
            {
                writer.WriteIntegerField("port", -1);
            }
            else
            {
                writer.WriteIntegerField("port", localService.Port);
            }

            writer.WriteStringField("serviceId", localService?.ServiceId);
            writer.WriteStringField("id", contextId);
            writer.WriteEndObject();
        }
Beispiel #10
0
        private static void WriteCollapserMetrics(JsonTextWriter writer, HystrixCollapserMetrics collapserMetrics)
        {
            IHystrixCollapserKey key = collapserMetrics.CollapserKey;

            writer.WriteStartObject();

            writer.WriteStringField("type", "HystrixCollapser");
            writer.WriteStringField("name", key.Name);
            writer.WriteLongField("currentTime", Time.CurrentTimeMillisJava);

            writer.WriteLongField("rollingCountRequestsBatched", collapserMetrics.GetRollingCount(CollapserEventType.ADDED_TO_BATCH));

            writer.WriteLongField("rollingCountBatches", collapserMetrics.GetRollingCount(CollapserEventType.BATCH_EXECUTED));

            writer.WriteLongField("rollingCountResponsesFromCache", collapserMetrics.GetRollingCount(CollapserEventType.RESPONSE_FROM_CACHE));


            // batch size percentiles
            writer.WriteIntegerField("batchSize_mean", collapserMetrics.BatchSizeMean);
            writer.WriteObjectFieldStart("batchSize");
            writer.WriteIntegerField("25", collapserMetrics.GetBatchSizePercentile(25));
            writer.WriteIntegerField("50", collapserMetrics.GetBatchSizePercentile(50));
            writer.WriteIntegerField("75", collapserMetrics.GetBatchSizePercentile(75));
            writer.WriteIntegerField("90", collapserMetrics.GetBatchSizePercentile(90));
            writer.WriteIntegerField("95", collapserMetrics.GetBatchSizePercentile(95));
            writer.WriteIntegerField("99", collapserMetrics.GetBatchSizePercentile(99));
            writer.WriteIntegerField("99.5", collapserMetrics.GetBatchSizePercentile(99.5));
            writer.WriteIntegerField("100", collapserMetrics.GetBatchSizePercentile(100));
            writer.WriteEndObject();


            writer.WriteBooleanField("propertyValue_requestCacheEnabled", collapserMetrics.Properties.RequestCacheEnabled);
            writer.WriteIntegerField("propertyValue_maxRequestsInBatch", collapserMetrics.Properties.MaxRequestsInBatch);
            writer.WriteIntegerField("propertyValue_timerDelayInMilliseconds", collapserMetrics.Properties.TimerDelayInMilliseconds);

            writer.WriteIntegerField("reportingHosts", 1); // this will get summed across all instances in a cluster

            writer.WriteEndObject();
        }
        private static void WriteCommandMetrics(JsonTextWriter writer, HystrixCommandMetrics commandMetrics)
        {
            IHystrixCommandKey     key            = commandMetrics.CommandKey;
            IHystrixCircuitBreaker circuitBreaker = HystrixCircuitBreakerFactory.GetInstance(key);

            writer.WriteStartObject();
            writer.WriteStringField("type", "HystrixCommand");
            writer.WriteStringField("name", key.Name);
            writer.WriteStringField("group", commandMetrics.CommandGroup.Name);
            writer.WriteLongField("currentTime", Time.CurrentTimeMillisJava);

            // circuit breaker
            if (circuitBreaker == null)
            {
                // circuit breaker is disabled and thus never open
                writer.WriteBooleanField("isCircuitBreakerOpen", false);
            }
            else
            {
                writer.WriteBooleanField("isCircuitBreakerOpen", circuitBreaker.IsOpen);
            }

            HealthCounts healthCounts = commandMetrics.Healthcounts;

            writer.WriteIntegerField("errorPercentage", healthCounts.ErrorPercentage);
            writer.WriteLongField("errorCount", healthCounts.ErrorCount);
            writer.WriteLongField("requestCount", healthCounts.TotalRequests);

            // rolling counters
            writer.WriteLongField("rollingCountBadRequests", commandMetrics.GetRollingCount(HystrixEventType.BAD_REQUEST));
            writer.WriteLongField("rollingCountCollapsedRequests", commandMetrics.GetRollingCount(HystrixEventType.COLLAPSED));
            writer.WriteLongField("rollingCountEmit", commandMetrics.GetRollingCount(HystrixEventType.EMIT));
            writer.WriteLongField("rollingCountExceptionsThrown", commandMetrics.GetRollingCount(HystrixEventType.EXCEPTION_THROWN));
            writer.WriteLongField("rollingCountFailure", commandMetrics.GetRollingCount(HystrixEventType.FAILURE));
            writer.WriteLongField("rollingCountFallbackEmit", commandMetrics.GetRollingCount(HystrixEventType.FALLBACK_EMIT));
            writer.WriteLongField("rollingCountFallbackFailure", commandMetrics.GetRollingCount(HystrixEventType.FALLBACK_FAILURE));
            writer.WriteLongField("rollingCountFallbackMissing", commandMetrics.GetRollingCount(HystrixEventType.FALLBACK_MISSING));
            writer.WriteLongField("rollingCountFallbackRejection", commandMetrics.GetRollingCount(HystrixEventType.FALLBACK_REJECTION));
            writer.WriteLongField("rollingCountFallbackSuccess", commandMetrics.GetRollingCount(HystrixEventType.FALLBACK_SUCCESS));
            writer.WriteLongField("rollingCountResponsesFromCache", commandMetrics.GetRollingCount(HystrixEventType.RESPONSE_FROM_CACHE));
            writer.WriteLongField("rollingCountSemaphoreRejected", commandMetrics.GetRollingCount(HystrixEventType.SEMAPHORE_REJECTED));
            writer.WriteLongField("rollingCountShortCircuited", commandMetrics.GetRollingCount(HystrixEventType.SHORT_CIRCUITED));
            writer.WriteLongField("rollingCountSuccess", commandMetrics.GetRollingCount(HystrixEventType.SUCCESS));
            writer.WriteLongField("rollingCountThreadPoolRejected", commandMetrics.GetRollingCount(HystrixEventType.THREAD_POOL_REJECTED));
            writer.WriteLongField("rollingCountTimeout", commandMetrics.GetRollingCount(HystrixEventType.TIMEOUT));

            writer.WriteIntegerField("currentConcurrentExecutionCount", commandMetrics.CurrentConcurrentExecutionCount);
            writer.WriteLongField("rollingMaxConcurrentExecutionCount", commandMetrics.RollingMaxConcurrentExecutions);

            // latency percentiles
            writer.WriteIntegerField("latencyExecute_mean", commandMetrics.ExecutionTimeMean);
            writer.WriteObjectFieldStart("latencyExecute");
            writer.WriteIntegerField("0", commandMetrics.GetExecutionTimePercentile(0));
            writer.WriteIntegerField("25", commandMetrics.GetExecutionTimePercentile(25));
            writer.WriteIntegerField("50", commandMetrics.GetExecutionTimePercentile(50));
            writer.WriteIntegerField("75", commandMetrics.GetExecutionTimePercentile(75));
            writer.WriteIntegerField("90", commandMetrics.GetExecutionTimePercentile(90));
            writer.WriteIntegerField("95", commandMetrics.GetExecutionTimePercentile(95));
            writer.WriteIntegerField("99", commandMetrics.GetExecutionTimePercentile(99));
            writer.WriteIntegerField("99.5", commandMetrics.GetExecutionTimePercentile(99.5));
            writer.WriteIntegerField("100", commandMetrics.GetExecutionTimePercentile(100));
            writer.WriteEndObject();
            writer.WriteIntegerField("latencyTotal_mean", commandMetrics.TotalTimeMean);
            writer.WriteObjectFieldStart("latencyTotal");
            writer.WriteIntegerField("0", commandMetrics.GetTotalTimePercentile(0));
            writer.WriteIntegerField("25", commandMetrics.GetTotalTimePercentile(25));
            writer.WriteIntegerField("50", commandMetrics.GetTotalTimePercentile(50));
            writer.WriteIntegerField("75", commandMetrics.GetTotalTimePercentile(75));
            writer.WriteIntegerField("90", commandMetrics.GetTotalTimePercentile(90));
            writer.WriteIntegerField("95", commandMetrics.GetTotalTimePercentile(95));
            writer.WriteIntegerField("99", commandMetrics.GetTotalTimePercentile(99));
            writer.WriteIntegerField("99.5", commandMetrics.GetTotalTimePercentile(99.5));
            writer.WriteIntegerField("100", commandMetrics.GetTotalTimePercentile(100));
            writer.WriteEndObject();

            // property values for reporting what is actually seen by the command rather than what was set somewhere
            IHystrixCommandOptions commandProperties = commandMetrics.Properties;

            writer.WriteIntegerField("propertyValue_circuitBreakerRequestVolumeThreshold", commandProperties.CircuitBreakerRequestVolumeThreshold);
            writer.WriteIntegerField("propertyValue_circuitBreakerSleepWindowInMilliseconds", commandProperties.CircuitBreakerSleepWindowInMilliseconds);
            writer.WriteIntegerField("propertyValue_circuitBreakerErrorThresholdPercentage", commandProperties.CircuitBreakerErrorThresholdPercentage);
            writer.WriteBooleanField("propertyValue_circuitBreakerForceOpen", commandProperties.CircuitBreakerForceOpen);
            writer.WriteBooleanField("propertyValue_circuitBreakerForceClosed", commandProperties.CircuitBreakerForceClosed);
            writer.WriteBooleanField("propertyValue_circuitBreakerEnabled", commandProperties.CircuitBreakerEnabled);

            writer.WriteStringField("propertyValue_executionIsolationStrategy", commandProperties.ExecutionIsolationStrategy.ToString());
            writer.WriteIntegerField("propertyValue_executionIsolationThreadTimeoutInMilliseconds", commandProperties.ExecutionTimeoutInMilliseconds);
            writer.WriteIntegerField("propertyValue_executionTimeoutInMilliseconds", commandProperties.ExecutionTimeoutInMilliseconds);
            writer.WriteBooleanField("propertyValue_executionIsolationThreadInterruptOnTimeout", false);
            writer.WriteStringField("propertyValue_executionIsolationThreadPoolKeyOverride", commandProperties.ExecutionIsolationThreadPoolKeyOverride);
            writer.WriteIntegerField("propertyValue_executionIsolationSemaphoreMaxConcurrentRequests", commandProperties.ExecutionIsolationSemaphoreMaxConcurrentRequests);
            writer.WriteIntegerField("propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests", commandProperties.FallbackIsolationSemaphoreMaxConcurrentRequests);
            writer.WriteIntegerField("propertyValue_metricsRollingStatisticalWindowInMilliseconds", commandProperties.MetricsRollingStatisticalWindowInMilliseconds);
            writer.WriteBooleanField("propertyValue_requestCacheEnabled", commandProperties.RequestCacheEnabled);
            writer.WriteBooleanField("propertyValue_requestLogEnabled", commandProperties.RequestLogEnabled);
            writer.WriteIntegerField("reportingHosts", 1); // this will get summed across all instances in a cluster
            writer.WriteStringField("threadPool", commandMetrics.ThreadPoolKey.Name);
            writer.WriteEndObject();
        }
        /// <inheritdoc />
        /// <summary>
        /// Writes this class as json using <code>generator</code>.
        /// This method is valid only in an array context or in no context (see <see cref="M:Newtonsoft.Json.JsonTextWriter.WriteStartObject" />.
        /// Requires the current objects list to be correctly sorted, otherwise the written
        /// <see cref="T:SavegameToolkit.Types.ObjectReference" /> might be broken.
        /// </summary>
        /// <param name="writer"><see cref="T:Newtonsoft.Json.JsonTextWriter" /> to write with</param>
        /// <param name="writingOptions"></param>
        public void WriteJson(JsonTextWriter writer, WritingOptions writingOptions)
        {
            writer.WriteStartObject();

            writer.WriteField("saveVersion", SaveVersion);
            writer.WriteField("gameTime", GameTime);

            writer.WriteField("saveCount", SaveCount);

            if (!writingOptions.Compact && OldNameList != null && OldNameList.Any())
            {
                writer.WriteArrayFieldStart("preservedNames");

                foreach (string oldName in OldNameList)
                {
                    writer.WriteValue(oldName);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && DataFiles.Any())
            {
                writer.WriteArrayFieldStart("dataFiles");

                foreach (string dataFile in DataFiles)
                {
                    writer.WriteValue(dataFile);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && EmbeddedData.Any())
            {
                writer.WriteArrayFieldStart("embeddedData");

                foreach (EmbeddedData data in EmbeddedData)
                {
                    data.WriteJson(writer);
                }

                writer.WriteEndArray();
            }

            if (DataFilesObjectMap.Any())
            {
                writer.WriteObjectFieldStart("dataFilesObjectMap");

                foreach (KeyValuePair <int, List <string[]> > entry in DataFilesObjectMap)
                {
                    writer.WriteArrayFieldStart(entry.Key.ToString());
                    foreach (string[] namesList in entry.Value)
                    {
                        writer.WriteStartArray();
                        foreach (string name in namesList)
                        {
                            writer.WriteValue(name);
                        }

                        writer.WriteEndArray();
                    }

                    writer.WriteEndArray();
                }

                writer.WriteEndObject();
            }

            if (Objects.Any())
            {
                writer.WriteArrayFieldStart("objects");

                foreach (GameObject gameObject in Objects)
                {
                    gameObject.WriteJson(writer, writingOptions);
                }

                writer.WriteEndArray();
            }

            writer.WriteObjectFieldStart("hibernation");

            if (!writingOptions.Compact)
            {
                writer.WriteField("v8Unknown1", hibernationV8Unknown1);
                writer.WriteField("v8Unknown2", hibernationV8Unknown2);
                writer.WriteField("v8Unknown3", hibernationV8Unknown3);
                writer.WriteField("v8Unknown4", hibernationV8Unknown4);

                writer.WriteField("unknown1", hibernationUnknown1);
                writer.WriteField("unknown2", hibernationUnknown2);
            }

            if (!writingOptions.Compact && hibernationClasses.Any())
            {
                writer.WriteArrayFieldStart("classes");

                foreach (string hibernationClass in hibernationClasses)
                {
                    writer.WriteValue(hibernationClass);
                }

                writer.WriteEndArray();
            }

            if (!writingOptions.Compact && hibernationIndices.Any())
            {
                writer.WriteArrayFieldStart("indices");

                foreach (int hibernationIndex in hibernationIndices)
                {
                    writer.WriteValue(hibernationIndex);
                }

                writer.WriteEndArray();
            }

            if (HibernationEntries.Any())
            {
                writer.WriteArrayFieldStart("entries");

                foreach (HibernationEntry hibernationEntry in HibernationEntries)
                {
                    hibernationEntry.WriteJson(writer, writingOptions);
                }

                writer.WriteEndArray();
            }

            writer.WriteEndObject();

            writer.WriteEndObject();
        }
Beispiel #13
0
 private static void WriteCommandUtilizationJson(JsonTextWriter json, IHystrixCommandKey key, HystrixCommandUtilization utilization)
 {
     json.WriteObjectFieldStart(key.Name);
     json.WriteIntegerField("activeCount", utilization.ConcurrentCommandCount);
     json.WriteEndObject();
 }