Class ::nsmcp::StatsTool (public)
::nx::Class ::nsmcp::StatsTool
Defined in /usr/local/ns/tcl/nsmcp/stats-tools.tcl
- Testcases:
- No testcase defined.
Source code: :property {permission diagnostics.runtime.read} :property {command ::ns_stats} :method encode {role value} { # Container types come from the ns_stats contract, never from Tcl's # internal representation or from guessing whether a string is a dict. if {$role in {strings numbers describeDrivers records events gaps}} { set fields {} set index 0 foreach item $value { if {$role eq "strings"} { lappend fields $index string $item } elseif {$role eq "numbers"} { lappend fields $index number $item } else { set child [expr {$role eq "describeDrivers" ? "driver" : ($role eq "records" ? "runtime" : "metrics")}] lappend fields $index object [:encode $child $item] } incr index } return $fields } set fields {} dict for {key item} $value { set child {} switch -- $role { topology - runtime { switch -- $key { process { set child process } servers { set child servers } drivers { set child [expr {$role eq "topology" ? "describeDrivers" : "metricMap"}] } queues { set child queues } cpu - databasePools { set child metricMap } cpuPercent { set child cpuPercent } availability { set child availability } units { set child stringsObject } sampling { set child metrics } } } history { switch -- $key { records { set child records } topologies { set child topologies } coverage { set child coverage } storage { set child metrics } } } schedulerDiagnostics { if {$key eq "counters"} { set child schedulerCounters } if {$key eq "comparison"} { set child schedulerComparison } } schedulerComparison { if {$key eq "metrics"} { set child metricMap } } schedulerCounters { if {$key in {waitReturnLateness mutexAcquisition nonThreadedCallbacks dispatchLateness dispatchDelay workerQueueDelay threadedCallbacks callbackOverrun}} { set child metrics } if {$key in {workers queues}} { set child schedulerCounts } } topologies { set child topology } coverage { if {$key in {events gaps}} { set child $key } if {$key eq "restartBoundaries"} { set child numbers } if {$key eq "incompleteReasons"} { set child strings } } servers { set child server } server { switch -- $key { pools { set child pools } bindings { set child metricMap } availability { set child availability } modules - databasePools { set child strings } } } pools { set child metrics } metricMap { set child metrics } queues { set child metricMap } process { if {$key eq "platform"} { set child stringsObject } if {$key in {allocatorBytes cpuCapacity}} { set child metrics } } cpuPercent { if {$key eq "groups"} { set child metrics } if {$key eq "threads"} { set child metricMap } } metrics - driver { if {$key eq "throttling"} { set child metricMap } if {$key eq "incompleteReasons"} { set child strings } if {$key in {counters gauges socketStates threads deltas rates timingAverageSeconds}} { set child metrics } if {$key in {resetCounters hostMappings}} { set child strings } } } if {$child ne ""} { set type [expr {$child in {strings numbers describeDrivers records events gaps} ? "array" : "object"}] lappend fields $key $type [:encode $child $item] } elseif {$role eq "schedulerCounts"} { lappend fields $key number $item } elseif {$role eq "availability" || $key in {ready running reset hostMappingsComplete enabled available complete maxCallbackTruncated constraintsComplete throttlingAvailable windowExamined more evictionOrFailureOverlap newMaximum}} { lappend fields $key boolean $item } elseif {$role eq "stringsObject" || $key in { scope baselineSource limitations instance name group thread module type server location address protocol libraryversion host version build os osVersion machine maxCallback driver dbtype scheduler lastError lastFailure owner pool reason topologyId }} { lappend fields $key string $item } elseif {$item eq ""} { lappend fields $key null {} } elseif {[string is double -strict $item]} { lappend fields $key number $item } else { # Preserve unrecognized scalar additions as text; never evaluate # them or recursively interpret arbitrary configuration strings. lappend fields $key string $item } } return $fields } :method available {} { return [expr {[info commands ${:command}] ne ""}] } :method unavailable {context} { return [list {} object [list server string [$context server] available boolean false reason string {ns_stats is unavailable; install a NaviServer version providing the NX diagnostics interface.}]] }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)