Пример #1
0
        public override void Visit(StoreResponseStatistics storeResponseStatistics)
        {
            this.jsonWriter.WriteStartObject();

            this.jsonWriter.WritePropertyName("Id");
            this.jsonWriter.WriteValue("StoreResponseStatistics");

            this.jsonWriter.WritePropertyName("ResponseTimeUtc");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestResponseTime.ToString("o", CultureInfo.InvariantCulture));

            this.jsonWriter.WritePropertyName("ResourceType");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestResourceType.ToString());

            this.jsonWriter.WritePropertyName("OperationType");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestOperationType.ToString());

            this.jsonWriter.WritePropertyName("LocationEndpoint");
            this.jsonWriter.WriteValue(storeResponseStatistics.LocationEndpoint);

            if (storeResponseStatistics.StoreResult != null)
            {
                this.jsonWriter.WritePropertyName("StoreResult");
                this.jsonWriter.WriteValue(storeResponseStatistics.StoreResult.ToString());
            }

            this.jsonWriter.WriteEndObject();
        }
Пример #2
0
        public override void Visit(StoreResponseStatistics storeResponseStatistics)
        {
            this.jsonWriter.WriteStartObject();

            this.jsonWriter.WritePropertyName("Id");
            this.jsonWriter.WriteValue("StoreResponseStatistics");

            this.jsonWriter.WritePropertyName("StartTimeUtc");
            if (storeResponseStatistics.RequestStartTime.HasValue)
            {
                this.jsonWriter.WriteValue(storeResponseStatistics.RequestStartTime.Value.ToString("o", CultureInfo.InvariantCulture));
            }
            else
            {
                this.jsonWriter.WriteValue("Start time never set");
            }

            this.jsonWriter.WritePropertyName("ResponseTimeUtc");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestResponseTime.ToString("o", CultureInfo.InvariantCulture));

            if (storeResponseStatistics.RequestStartTime.HasValue)
            {
                this.jsonWriter.WritePropertyName("ElapsedTimeInMs");
                TimeSpan totaltime = storeResponseStatistics.RequestResponseTime - storeResponseStatistics.RequestStartTime.Value;
                this.jsonWriter.WriteValue(totaltime.TotalMilliseconds);
            }

            this.jsonWriter.WritePropertyName("ResourceType");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestResourceType.ToString());

            this.jsonWriter.WritePropertyName("OperationType");
            this.jsonWriter.WriteValue(storeResponseStatistics.RequestOperationType.ToString());

            this.jsonWriter.WritePropertyName("LocationEndpoint");
            this.jsonWriter.WriteValue(storeResponseStatistics.LocationEndpoint);

            if (storeResponseStatistics.StoreResult != null)
            {
                this.jsonWriter.WritePropertyName("ActivityId");
                this.jsonWriter.WriteValue(storeResponseStatistics.StoreResult.ActivityId);

                this.jsonWriter.WritePropertyName("StoreResult");
                this.jsonWriter.WriteValue(storeResponseStatistics.StoreResult.ToString());
            }

            this.jsonWriter.WriteEndObject();
        }