nsmcp::ServerHistory method execute (public)

 <instance of nsmcp::ServerHistory[i]> execute context arguments

Defined in /usr/local/ns/tcl/nsmcp/lib/stats-tools.tcl

Parameters:
context (required)
arguments (required)

Testcases:
No testcase defined.
Source code:
if {![:available]} {
    return [:unavailable $context]
}
set options [:options $arguments]
set status [${:command} history status]
set configured [dict exists $status pool]
set fields [list server string [$context server] available boolean true  configured boolean $configured persistence object [:encode metrics $status]]
if {!$configured} {
    lappend fields reason string {Configure ns_stats history with a dedicated nsdbsqlite pool to retain interval samples.}
    return [list {} object $fields]
}
set query [list ${:command} history query -server [$context server]]
dict for {key value} $options {
    lappend query -$key $value
}
set history [{*}$query]
lappend fields history object [:encode history $history]
if {[dict get $history more]} {
    set next [list from number [dict get $history from] to number [dict get $history to]  limit number [dict get $options limit] cursor number [dict get $history nextCursor]]
    lappend fields nextArguments object $next
} else {
    lappend fields nextArguments null {}
}
return [list {} object $fields]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: