protected override void WriteIndexUtilizationInfo(IndexUtilizationInfo indexUtilizationInfo)
        {
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.UtilizedIndexes, indentLevel: 1);

            foreach (IndexUtilizationData indexUtilizationData in indexUtilizationInfo.UtilizedIndexes)
            {
                WriteIndexUtilizationData(indexUtilizationData);
            }

            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.PotentialIndexes, indentLevel: 1);

            foreach (IndexUtilizationData indexUtilizationData in indexUtilizationInfo.PotentialIndexes)
            {
                WriteIndexUtilizationData(indexUtilizationData);
            }

            void WriteIndexUtilizationData(IndexUtilizationData indexUtilizationData)
            {
                QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, $"{QueryMetricsTextWriter.FilterExpression}: {indexUtilizationData.FilterExpression}", indentLevel: 2);
                QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, $"{QueryMetricsTextWriter.IndexExpression}: {indexUtilizationData.IndexDocumentExpression}", indentLevel: 2);
                QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, $"{QueryMetricsTextWriter.FilterExpressionPrecision}: {indexUtilizationData.FilterExpressionPrecision}", indentLevel: 2);
                //QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, $"{QueryMetricsTextWriter.IndexPlanFullFidelity}: {indexUtilizationData.IndexPlanFullFidelity}", indentLevel: 2); //currently not exposed to the users
                QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, IndexUtilizationSeparator, indentLevel: 2);
            }
        }
        protected override void WriteBeforeSchedulingMetrics()
        {
            QueryMetricsTextWriter.AppendNewlineToStringBuilder(this.stringBuilder);

            // Building the table for scheduling metrics
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.SchedulingMetrics, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, SchedulingMetricsTable.TopLine, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, SchedulingMetricsTable.Header, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, SchedulingMetricsTable.MiddleLine, indentLevel: 1);
        }
        protected override void WriteBeforePartitionExecutionTimeline()
        {
            QueryMetricsTextWriter.AppendNewlineToStringBuilder(this.stringBuilder);

            // Building the table for fetch execution ranges
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.FetchExecutionRanges, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, PartitionExecutionTimelineTable.TopLine, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, PartitionExecutionTimelineTable.Header, indentLevel: 1);
            QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, PartitionExecutionTimelineTable.MiddleLine, indentLevel: 1);
        }
 protected override void WriteAfterPartitionSchedulingTimeSpan()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(
         this.stringBuilder,
         SchedulingMetricsTable.GetRow(
             this.lastSchedulingPartitionId,
             this.lastResponseTime.TotalMilliseconds.ToString("0.00"),
             this.lastRunTime.TotalMilliseconds.ToString("0.00"),
             this.lastWaitTime.TotalMilliseconds.ToString("0.00"),
             this.lastTurnaroundTime.TotalMilliseconds.ToString("0.00"),
             this.lastNumberOfPreemptions),
         indentLevel: 1);
 }
 protected override void WriteAfterFetchExecutionRange()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(
         this.stringBuilder,
         PartitionExecutionTimelineTable.GetRow(
             this.lastFetchPartitionId,
             this.lastActivityId,
             this.lastStartTime.ToUniversalTime().ToString(DateTimeFormat),
             this.lastEndTime.ToUniversalTime().ToString(DateTimeFormat),
             (this.lastEndTime - this.lastStartTime).TotalMilliseconds.ToString("0.00"),
             this.lastFetchDocumentCount,
             this.lastFetchRetryCount),
         indentLevel: 1);
 }
 private static void AppendNewlineToStringBuilder(StringBuilder stringBuilder)
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(stringBuilder, string.Empty, 0);
 }
 protected override void WriteBeforeIndexUtilizationInfo()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.IndexUtilizationInfo, indentLevel: 0);
 }
 protected override void WriteAfterSchedulingMetrics()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, SchedulingMetricsTable.BottomLine, indentLevel: 1);
 }
 protected override void WriteAfterPartitionExecutionTimeline()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, PartitionExecutionTimelineTable.BottomLine, indentLevel: 1);
 }
 protected override void WriteBeforeClientSideMetrics()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.ClientSideQueryMetrics, indentLevel: 0);
 }
 protected override void WriteBeforeRuntimeExecutionTimes()
 {
     QueryMetricsTextWriter.AppendHeaderToStringBuilder(this.stringBuilder, QueryMetricsTextWriter.RuntimeExecutionTimes, indentLevel: 1);
 }