::nsmcp::Tool ::nsmcp::Tool dependenciesPresent describe execute init jsonArguments name permission validate ::nsmcp::Object ::nsmcp::Object destroy dict getdef ::nsmcp::Tool->::nsmcp::Object ::nsmcp::AccessSlowDayTool ::nsmcp::AccessSlowDayTool execute options validate ::nsmcp::AccessSlowDayTool->::nsmcp::Tool

Class ::nsmcp::AccessSlowDayTool

::nsmcp::AccessSlowDayTool[i] create ... \
           [ -adminExample (default "") ] \
           [ -adminSummary (default "") ] \
           [ -description (default "Chart a calendar day of completed access requests grouped by logged request-start minute. Returns request, timed, at-least-1-second and at-least-2-second series from ingestion rollups, without a day-long detailed-row query. Slow thresholds sum queue, filter and run phases, excluding socket accept time because keep-alive connections can be reused. Defaults to today in Europe/Vienna. Old minutes are repaired incrementally; incompleteRequests and incompleteMinutes mark counts not yet valid. focusTime optionally repairs up to 15 preceding local minutes, including the focus minute. For a wider interval, rangeStart and rangeEnd repair up to 180 local minutes, with an exclusive end; these are mutually exclusive with focusTime. The current minute is excluded. Poll log_results for the job result.") ] \
           [ -inputSchema (default "{"type":"object","properties":{"date":{"type":"string","description":"Calendar day YYYY-MM-DD; defaults to today in the selected timezone"},"timezone":{"type":"string","description":"IANA timezone; defaults to Europe/Vienna"},"pool":{"type":"string","description":"Exact connection pool, optional"},"focusTime":{"type":"string","description":"Local HH:MM to repair first, including preceding focusMinutes"},"focusMinutes":{"type":"integer","minimum":1,"maximum":15,"description":"Preceding minutes to repair; default 10 when focusTime is set"},"rangeStart":{"type":"string","description":"Local HH:MM to start a bounded repair interval"},"rangeEnd":{"type":"string","description":"Exclusive local HH:MM end of a bounded repair interval, at most 180 minutes later"}},"additionalProperties":false}") ] \
           [ -name (default "access_slow_day") ] \
           [ -outputSchema (default "") ] \
           [ -permission (default "diagnostics.logs.read") ] \
           [ -service:required service:required ]

Defined in /usr/local/ns/tcl/nsmcp/access-tools.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nsmcp::Tool[i]
::nx::Class create ::nsmcp::AccessSlowDayTool \
     -superclass ::nsmcp::Tool

Methods (to be applied on instances)

  • execute (scripted, public)

     <instance of nsmcp::AccessSlowDayTool[i]> execute context arguments
    Parameters:
    context (required)
    arguments (required)

    Testcases:
    No testcase defined.
    return [${:service} start $context accessSlowDay [:options $arguments]]
  • options (scripted, public)

     <instance of nsmcp::AccessSlowDayTool[i]> options arguments
    Parameters:
    arguments (required)

    Testcases:
    No testcase defined.
    if {[lindex $arguments 1] ne "object"} {error "Expected arguments object"}
    set options [dict create timezone :Europe/Vienna pool {}]
    foreach {key type value} [lindex $arguments 2] {
        if {$key eq "focusMinutes"} {
            if {$type ne "number" || ![string is entier -strict $value] || $value<1 || $value>15} {
                error "focusMinutes must be 1..15"
            }
        } elseif {$key ni {date timezone pool focusTime rangeStart rangeEnd} || $type ne "string"} {
            error "Expected date, timezone, pool, focusTime, rangeStart or rangeEnd string"
        }
        dict set options $key $value
    }
    set timezone [dict get $options timezone]
    if {![regexp {^:?[A-Za-z][A-Za-z0-9_+/-]{0,63}$} $timezone]} {error "Invalid timezone"}
    if {![dict exists $options date]} {
        dict set options date [clock format [clock seconds] -timezone $timezone -format %Y-%m-%d]
    }
    set date [dict get $options date]
    if {![regexp {^[0-9]{4}-[0-9]{2}-[0-9]{2}$} $date]} {error "Expected date YYYY-MM-DD"}
    set start [clock scan $date -format %Y-%m-%d -timezone $timezone]
    if {[clock format $start -timezone $timezone -format %Y-%m-%d] ne $date} {error "Invalid date"}
    if {$start>[clock seconds] || $start<[clock seconds]-8*86400} {error "Day is outside retained access data"}
    if {[string length [dict get $options pool]]>64} {error "Pool name too long"}
    if {[dict exists $options focusTime]} {
        if {![regexp {^([01][0-9]|2[0-3]):[0-5][0-9]$} [dict get $options focusTime]]} {
            error "focusTime must be HH:MM"
        }
        if {![dict exists $options focusMinutes]} {dict set options focusMinutes 10}
    } elseif {[dict exists $options focusMinutes]} {
        error "focusMinutes requires focusTime"
    }
    if {[dict exists $options rangeStart] != [dict exists $options rangeEnd]} {
        error "rangeStart and rangeEnd must be supplied together"
    }
    if {[dict exists $options rangeStart]} {
        if {[dict exists $options focusTime]} {error "range interval cannot be combined with focusTime"}
        foreach key {rangeStart rangeEnd} {
            if {![regexp {^([01][0-9]|2[0-3]):[0-5][0-9]$} [dict get $options $key]]} {
                error "$key must be HH:MM"
            }
        }
        set from [clock scan "$date [dict get $options rangeStart]"  -format {%Y-%m-%d %H:%M} -timezone $timezone]
        set to [clock scan "$date [dict get $options rangeEnd]"  -format {%Y-%m-%d %H:%M} -timezone $timezone]
        if {$to<=$from || $to-$from>180*60} {error "range interval must be 1..180 minutes"}
    }
    return $options
  • validate (scripted, public)

     <instance of nsmcp::AccessSlowDayTool[i]> validate arguments
    Parameters:
    arguments (required)

    Testcases:
    No testcase defined.
    if {[catch {:options $arguments} message]} {
        return -code error -errorcode {NSMCP RPC -32602} $message
    }