set data [list server string [dict get $summary server]]
foreach key {windowHandle intervalUTC} {
if {[dict exists $summary$key]} {
lappend data $key string [dict get $summary$key]
}
}
foreach key {from to bucketSeconds requestCount responseBytes fallbackCount excludedPaths timingCount acceptTotal queueTotal filterTotal runTotal runMax} {
lappend data $key number [dict get $summary$key]
}
lappend data unavailableTimingCount number [expr {[dict get $summary requestCount]-[dict get $summary timingCount]}] timingScope string {Worker phase timings only; driver synthetic phases are unavailable, not measured zeros.}
lappend data pathCountsComplete boolean [dict get $summary pathCountsComplete]
foreach key {pools methods statuses} {
set fields {}
dict for {name count} [dict get $summary$key] {
lappend fields $name number $count
}
lappend data $key object $fields
}
set paths {}
set index 0
set ranked {}
dict for {path count} [dict get $summary paths] {
lappend ranked [list$count$path]
}
foreach row [lrange [lsort -integer -decreasing -index 0 $ranked] 0 19] {
lassign$row count path
lappend paths $index object [list path string $path count number $count]
incr index
}
lappend data topPaths array $pathsset buckets {}
set index 0
foreach start [lsort -integer [dict keys [dict get $summary buckets]]] {
set count [dict get $summary buckets $start]
lappend buckets $index object [list from number $start count number $count]
incr index
}
lappend data buckets array $bucketsset peakFrom {}
set peakCount -1
foreach start [lsort -integer [dict keys [dict get $summary buckets]]] {
set count [dict get $summary buckets $start]
if {$count > $peakCount} {
set peakCount $countset peakFrom $start
}
}
if {$peakFrom ne ""} {
lappend data peakBucket object [list from number $peakFrom to number [expr {$peakFrom+[dict get $summary bucketSeconds]}] count number $peakCount requestsPerSecond number [expr {$peakCount/double([dict get $summary bucketSeconds])}] basis string {fixed bucket average; earliest tie; retained access records}]
}
set coverage {}
dict for {key value} [dict get $summary coverage] {
set type number
if {$key in {scanIncomplete pending minuteAligned windowComplete historyIncomplete seekPending completionOrderAssumed evictionOverlap sourceCaughtUp liveTailIncomplete historicalBackfillPending parseErrorScopeUnknown oversizedScopeUnknown peerCountsComplete observedPeerCountsComplete continuousStore writerFailure storageLimitExceeded}} {
set type boolean
}
if {$key in {incompleteReasons peerCountsIncompleteReasons}} {
set items {}
set i 0
foreach reason $value {
lappend items $i string $reasonincr i
}
lappend coverage $key array $itemscontinue
}
if {$key in {source writerFailureClass}} {
set type string
}
if {$value eq ""} {
set type null
}
lappend coverage $key$type$value
}
if {[dict exists $summary filters]} {
set fields {}
dict for {key value} [dict get $summary filters] {
lappend fields $key [expr {$key eq "status" ? "number" : "string"}] $value
}
lappend data filters object $fields
}
if {[dict exists $summary statusTimings]} {
set rows {}
set i 0
foreach row [dict get $summary statusTimings] {
set fields {}
dict for {key value} $row {
lappend fields $key number $value
}
lappend rows $i object $fieldsincr i
}
lappend data statusTimings array $rows
}
if {[dict exists $summary authenticationStates]} {
set states {}
dict for {state row} [dict get $summary authenticationStates] {
set fields {}
dict for {key value} $row {
lappend fields $key number $value
}
lappend states $state object $fields
}
lappend data authenticationStates object $states
}
if {[dict exists $summary peerBurst]} {
set fields {}
dict for {key value} [dict get $summary peerBurst] {
set type [expr {$key eq "peerAddress" ? "string" : "number"}]
if {$value eq ""} {
set type null
}
lappend fields $key$type$value
}
lappend data peerBurst object $fields
}
if {[dict exists $summary evictions]} {
set events {}
set i 0
foreach event [dict get $summary evictions] {
set fields {}
dict for {key value} $event {
lappend fields $key [expr {$key eq "reason" ? "string" : "number"}] $value
}
lappend events $i object $fieldsincr i
}
lappend data evictions array $events
}
lappend data coverage object $coveragereturn$data