从使用go-diameter编写的直径服务器收集应用程序监视数据

I have an application server based on go-diameter. It receives CCR for Credit Auth and responds with CCA. The CCR request received in the server has multiple attributes, for example RequestType (Init, Update, Terminate) I want to collect performance data for every type of request which includes total number of request and time taken by each Request Type. This data will be pushed to external system after a defined duration (say 15sec).

Currently what I have done is, I have created a global structure for each of the request type to keep the count. Along with this for every reqeust local variables are created to caputre the start and end time. This is added in the global structure's time component. The data from the global structure is pushed to external system after every 15sec and then the count and time is reset to zero.

I do not feel that it's the correct way of doing it. I was looking for golang packages which can do this, including locking and unlocking the global strcuture while updating and flushing.

Are their any golang packages available to achieve this more efficiently?