nsmcp::accessFailureContext (private)
nsmcp::accessFailureContext statsVar row options
Defined in /usr/local/ns/tcl/nsmcp/examples/nsmcp-openacs-api-docs.tcl
Count a selected access record in the failed-traffic context before applying the status filter. @return Whether the record matches the requested failure selection.
- Parameters:
- statsVar (required)
- row (required)
- options (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar 1 $statsVar stats # Called after time/path selection. Pool/method/source select the context; # only the status predicate is withheld from the denominator. foreach key {pool method recordSource} { set value [dict get $options $key] if {$value ne {} && !($key eq "recordSource" && $value eq "all") && $value ne [dict get $row $key]} { return false } } dict incr stats contextRecords set status [dict get $row status] if {$status>=400} { dict incr stats contextFailedRecords } set index [expr {int(floor(([dict get $row startTime]-[dict get $options from])/[dict get $options bucketSeconds]))}] if {![dict exists $stats buckets $index]} { dict set stats buckets $index {contextRecords 0 contextFailedRecords 0 selectedRecords 0 driver503Records 0 timingCount 0 runTotal 0.0 contextTimingCount 0 contextRunTotal 0.0} } set bucket [dict get $stats buckets $index] dict incr bucket contextRecords if {$status>=400} { dict incr bucket contextFailedRecords } if {[dict get $row phaseTimingAvailable]} { dict incr bucket contextTimingCount dict set bucket contextRunTotal [expr {[dict get $bucket contextRunTotal]+[dict get $row runTime]}] } dict set stats buckets $index $bucket if {[dict get $options status] ne {} && $status!=[dict get $options status]} { return false } set class [dict get $options statusClass] if {$class eq "4xx/5xx"} { if {$status<400} { return false } } elseif {$class ne {} && $status/100!=[string index $class 0]} { return false } dict incr bucket selectedRecords set source [dict get $row recordSource] set sources [dict get $stats recordSources] dict incr sources $source dict set stats recordSources $sources if {$source eq "driver"} { # Driver labels are server configuration values, bounded by the parser. accessScanCount stats drivers [dict get $row driver] 64 if {$status==503} { dict incr stats driver503Records dict incr bucket driver503Records } } if {[dict get $row phaseTimingAvailable]} { dict incr bucket timingCount dict set bucket runTotal [expr {[dict get $bucket runTotal]+[dict get $row runTime]}] } dict set stats buckets $index $bucket if {![dict exists $stats statusTimings $status]} { dict set stats statusTimings $status {requestCount 0 timingCount 0 runTotal 0.0 runMax 0.0} } set timing [dict get $stats statusTimings $status] dict incr timing requestCount if {[dict get $row phaseTimingAvailable]} { dict incr timing timingCount dict set timing runTotal [expr {[dict get $timing runTotal]+[dict get $row runTime]}] dict set timing runMax [expr {max([dict get $timing runMax],[dict get $row runTime])}] } dict set stats statusTimings $status $timing return trueXQL Not present: Generic, PostgreSQL, Oracle