Fix stats API for vpp 22.06 73/36773/2
authorLukas Vogel <vogel@anapaya.net>
Thu, 28 Jul 2022 14:50:34 +0000 (16:50 +0200)
committerNathan Skrzypczak <nathan.skrzypczak@gmail.com>
Fri, 29 Jul 2022 07:40:44 +0000 (07:40 +0000)
commit0f05d2a3730dbe1659d5a310db6039e9c1373989
tree483e38256a682a4a0587ebd26920f67d0f8b7df4
parent4223b112aec2f4a1c8577b239932a1de38703bed
Fix stats API for vpp 22.06

VPP changed the error counters to be simple counters in
https://gerrit.fd.io/r/c/vpp/+/35640, that broke goVPP stats extraction.
This was partially fixed by https://gerrit.fd.io/r/c/govpp/+/36085,
however this fix didn't make it work completely.

There were some leftover conversions from dirType (== int) to StatType
(== string). Unfortunately the Go compiler does not flag those, they
would however be catched by go vet.

The fixes that are done here makes the stats extraction work for us
partially: We noticed that error counters are now of type symlink and
unfortunately updating a stat dir that contains symlink counters doesn't
work correctly. CopyEntryData, that is called when initializing the dir,
correctly handles the symlink counters. But updateStatOnIndex simply
ignores symlink counters because `dirType != entry.Type` will hold. We
didn't really figure out how to correctly handle this so this would need
to be picked up by someone who is more familiar with the code. For now
we work around this limitation by not using the GetErrorStats API and
instead manually read the dir everytime we want to access error
counters.

Co-authored-by: Sergio Gonzalez Monroy <monroy@anapaya.net>
Change-Id: I322133f362e782fea3e8a2be70967a796ba87b75
Signed-off-by: Lukas Vogel <vogel@anapaya.net>
adapter/statsclient/stat_segment_api.go
adapter/statsclient/statsclient.go
adapter/statsclient/statseg_v1.go
adapter/statsclient/statseg_v2.go