Class ::ns::ns_stats (public)
::nx::Class ::ns::ns_stats
Defined in /usr/local/ns/lib/nsf2.5.0/lib/nx-traits.tcl
- Testcases:
- No testcase defined.
Source code: ::nsf::object::alloc ::nx::Class ::ns::ns_stats {} ::ns::ns_stats public method {history persist} {} { # # Scheduled persistence entry point. Restore the configured history # mixins in this interpreter, then save the latest published sample. # Return without database access when persistence is disabled. # set config [nsv_get ns_stats history] if {$config eq "" || ![dict get $config enabled]} { return } :object mixins set [dict get $config mixins] :history save } ::ns::ns_stats protected method startup {} { # # Apply the process-wide ns/stats startup configuration once, in # the selected server's startup callback. Database modules and pool # permissions are available at this point. Reuse the public runtime # commands for validation, scheduling and persistence initialization. # Configuration is not reapplied by sampling or history callbacks. # set section ns/stats set server [ns_config $section server [lindex [ns_info servers] 0]] if {$server ne [ns_info server]} { return } set sampling [ns_config -bool $section sampling false] set pool [ns_config $section historyPool {}] if {!$sampling && $pool eq ""} { return } set interval [ns_baseunit -time [ns_config $section samplingInterval 10s]] if {$sampling && ($interval < 1 || $interval > 3600)} { error "ns/stats samplingInterval must be 1..3600 seconds" } if {$pool ne ""} { :history configure -pool $pool -retention [ns_config $section historyRetention 24h] -maxBytes [ns_config $section historyMaxBytes 64MiB] } if {$sampling} { :sampling start -interval $interval } } ::ns::ns_stats protected method syntaxErrors args { # NX qualifies the object name in generated usage. Present the public # command name consistently with NaviServer's other Tcl commands. try { next } on error {message options} { # Parameterless NX ensemble methods report only the final selector. set method [lindex $args 0] set ensemble [current calledmethod] if {(($ensemble eq "sampling" && $method in {stop status}) || ($ensemble eq "history" && $method in {status disable storage})) && $message eq "wrong # args: should be \"$method\""} { set message "wrong # args: should be \"ns_stats $ensemble $method\"" } return -options $options [string map { {should be "::ns_stats } {should be "ns_stats } {should be: ::ns_stats } {should be: ns_stats } } $message] } } ::nsf::relation::set ::ns::ns_stats superclass ::ns::stats::Sampler ::nx::slotObj -container slot ::ns::ns_stats ::nsf::relation::set ::ns::ns_stats class-filter {{syntaxErrors -guard {[current calledmethod] in {describe snapshot sample sampling history}}}}XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)