aboutsummaryrefslogtreecommitdiffstats
path: root/adapter/statsclient/statsclient.go
AgeCommit message (Collapse)AuthorFilesLines
2022-07-29Fix stats API for vpp 22.06Lukas Vogel1-2/+2
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>
2022-03-17Properly close the socket watcherVladimir Lavor1-0/+1
Signed-off-by: Vladimir Lavor <vlavor@cisco.com> Change-Id: I40665a0413f273e52bcaeaabacdf1bd55afcfd67
2021-06-01statsclient: fix retrieving stats typeVladimir Lavor1-1/+5
Signed-off-by: Vladimir Lavor <vlavor@cisco.com> Change-Id: Id51fa03ac69a2fc29aca5ff644178cdfcabe523c
2021-05-26statsclient: added symlinksVladimir Lavor1-2/+4
Symlink support based on https://gerrit.fd.io/r/c/vpp/+/31636 Added new stat types `CounterStat` and `CombinedCounterStat` which represent simple/combined value of a single item (interface, node) as a array of values by workers. Example: /if/names NameVector [local0 tap0 tap1] /if/ip6 SimpleCounterVector [[0 9 0] [0 25 3] [0 0 60] [0 0 0]] /interfaces/tap0/ip6 SimpleCounterVector [[9] [25] [0] [0]] /interfaces/tap1/ip6 SimpleCounterVector [[0] [3] [60] [0]] Field `Symlink` added to StatEntry to mark symlink stats. For stats v2 only Change-Id: Iadc825f3c42b05bfc9a91462dba8a0b0068c7cd6 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2021-05-05statsclient: allow index as patternVladimir Lavor1-103/+134
* ListStats() returns stats identifiers containing the stat name and index * New method PrepareDirOnIndex(indexes...). Instead of the name filter it does not browse through all available indexes * Stats example shows how to get the last epoch value (added "e" or "epoch" command) Change-Id: Ibb15090fb0dfdb7f9b0ecf8ac07a5eb9a9ace8f8 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2021-04-07Add statsclient options and fix wait for socketVladimir Lavor1-10/+44
Change-Id: Ib5674fee5862a2b16f4b0044b6f6af533a7b6b33 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2021-02-23Added asynchronous connection for stats socketVladimir Lavor1-30/+73
The stats socket now allows an option to connect asynchronously in the same manner as the api socket connection. New method AsyncConnectStats returns a channel where notificaitons of type ConnectionEvent will be sent. Fixed the stats reconnect procedure which sometimes failed to re-eneable the connection. Change-Id: I0bdb19f0d57e3a1ea259b8b1ba0a5e5fa49a09db Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-12-21Remove socket warnings from client adaptersOndrej Fabry1-34/+25
Change-Id: I5e72df39c0e4ba4f0a70d561d7f9b220b4e72a4c Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-09-22Reload stats socket when VPP restartsVladimir Lavor1-25/+100
The current implementation loads the stats socket and maps it to the memory. If VPP restarts, the socket file is recreated while the mapped data remain unchanged, silently failing since it does not get any updates. This change adds socket file monitoring which reconnects and remaps the socket file in such a case. Change-Id: I061f7400410f4dfe5de66ba7844c4ae1567bbcbe Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-09-07Remove unnecessary allocationVladimir Lavor1-10/+10
Change-Id: If77b7b37ae736fdf21f4c337350905480e6fb011 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-09-04Update VPP config warnings and change log level in proxyOndrej Fabry1-1/+1
Change-Id: I8f965a0758c4b7459f27a46c095dad232e331032 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2020-09-04Stats APIv2Vladimir Lavor1-126/+213
* Compatible with stats v2 API * Compatibility with stats v1 was persisted * 19.04 (legacy) dropped Change-Id: I91a3ab0c007fed6d972eee01d7caf69af29305d1 Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
2020-03-20Fix statsclient for VPP 20.05-rc0 (master)v0.3.2Ondrej Fabry1-29/+32
- this change fixes panic that was occurring with recent VPP that was caused by incorrectly calculated vector length - converting returned vector length from uint64 to uint32 results in correct length value Change-Id: I76a4b9d147c3df3bea9d3e5ef5853e2809dc42e8 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-10-03Optimizations for statsclientOndrej Fabry1-77/+196
- this dramatically improves performance for stats data collection - memory allocation is now done only when stat dirs change - updating prepared stat dir does not need to allocate memory - created integration test for testing stats client - added NumWorkerThreads and VectorRatePerWorker to SystemStats - added ReduceSimpleCounterStatIndex, ReduceCombinedCounterStatIndex for aggregating specific index Change-Id: I702731a69024ab5dd0832bb5cfe2773a987359e5 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-07-19Print info for users to stderr when socket files are missingOndrej Fabry1-14/+21
Change-Id: Ibdbfcb78b05cf80945a93ed424a7a2a03b6ea06d Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-07-03Fix error counters for VPP 19.04Ondrej Fabry1-121/+12
Change-Id: I87251362668bbe9a31f52c1b5e9b3ab596f7b2f3 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-07-01Fix reading statsclient entriesOndrej Fabry1-27/+35
- omit entries with empty/invalid names - change log level to debug for invalid entries - remove some excessive debug logs - improve log message when falling back to old stat segment version Change-Id: If9ceae9a42e586172bbec130452fba9dfbab2cd7 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-27Improvements for binapi-generator and support VPP 19.04 in statsclientOndrej Fabry1-187/+44
- RPC service client implementation for dumps requests now streams responses - RPC service generation is now enabled by default - examples now allow setting binapi socket address - input dir flag for binapi-generator will recursively look into dirs to support core/plugins in /usr/share/vpp/api - minor improvements in debug logs - add support for VPP 19.04 for statsclient Change-Id: I0939ee3aa6e9f850d073fc5c87aff4ccc56b0d70 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2019-06-20Add statsclient - pure Go implementation for stats APIOndrej Fabry1-0/+460
Change-Id: Ia5bab652c6089378697459f477f9060dc7a53e90 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>