Class ::ns::ns_stats (public)

 ::nx::Class ::ns::ns_stats[i]

Defined in

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
        }
    }
::nsf::relation::set ::ns::ns_stats superclass ::ns::stats::Sampler


::nx::slotObj -container slot ::ns::ns_stats
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: