I haven't hadn't much interaction with iStats, but I can share what I have done. First I found that wrapping the call in a catch block helps keep errors from causing client-side issues. I was also looking at per-virtual server stats, so it would add them for the VS the iRule is assigned to.
Here's what my code looks like (it's used to track hostnames used to access the VIP)
Track the hosts that are used by this VIP
if { [catch { ISTATS::incr "ltm.virtual [virtual name] c [HTTP::host]" 1 } emsg] } {
log local0. "ISTATS error | Error adding stats to '[HTTP::host]' | '$emsg'"
}
To view the stats in TMSH: "tmsh show ltm virtual XYZ " (where XYZ is the virtual server name)
You could probably modify it to use the OS name instead of host.
Hope this helps.