-
Notifications
You must be signed in to change notification settings - Fork 30
Description
We want to record the network usage of a single Fleetspeak client deployed, so that we can later on plot, inspect and analyze this data for measuring performance and be alerted if there are any unexpected "spikes" in network usage.
An example for a use case is GRR, that has a dashboard for Client Load Stats (google/grr#859) which fetches its data from Fleetspeak server's datastore.
The concept is similar to other metrics gathered from Fleetspeak clients, such as resident memory size.
As an example, check out #275 to learn more about how IO MiB read/write is implemented.
Implementation details:
Other metrics gathered for individual Fleetspeak clients are using the ResourceUsageFetcher struct, and specifically the method ResourceUsageForPID. Unlike those metrics, the kernel does not have information about the network usage of a given process PID, so this cannot be fetched using the library gopsutil.
Thus, an idea for implementing this: add a new struct (a singleton effectively) that will become a field in ResourceUsageFetcher. This new singleton will also be shared with the StreamingCommunicator struct (note that an implementation may needed for polling as well), so network usage data can be recorded when messages enter/exit the Fleetspeak client in the methods readLoop and writeLoop, where both are called from the connect method of StreamingCommunicator.