nsmcp::AccessDiagnosticTool method nativeClassify (public)

 <instance of nsmcp::AccessDiagnosticTool[i]> nativeClassify server \
    record snapshot target

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

Classify a request using native contextual routing. Combine the native mapping with context completeness and target-pool diagnostics.

Parameters:
server (required)
Selected NaviServer virtual-server name.
record (required)
Recorded request fields or routing-evidence dictionary.
snapshot (required)
Routing snapshot with availability metadata.
target (required)
Target connection pool used for the diagnostic comparison.
Returns:
The native classification dictionary with explicit uncertainty.

Testcases:
No testcase defined.
Source code:
set result [dict create lookupMode native-context expectedPool unknown  contextComplete [:contextComplete $record $snapshot] category unknown  matchingRuleIndexes {} unknownRules 0 lookupError {}]
if {![dict get $result contextComplete]} {
    return $result
}
if {[catch {
    ${:routing} mapped $server $record
} expected]} {
    # A row-specific lookup error must not silently become fallback
    # rule membership or a claim that the default pool is correct.
    dict set result lookupError {Native route lookup failed for this record.}
    return $result
}
dict set result expectedPool $expected
set actual [dict get $record pool]
if {$actual eq "unknown"} {
    return $result
}
if {$expected eq $target} {
    dict set result category [expr {$actual eq $target ? "native-target-in-target" : "native-target-other-pool-candidate"}]
} elseif {[dict exists $record userAgent] &&
          [regexp -nocase {bot|crawl|spider|baidu|knowledge} [dict get $record userAgent]] && $actual ne $target} {
    dict set result category bot-like-routed-elsewhere-heuristic
} else {
    dict set result category native-other-pool
}
return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: