PR

https://github.com/apache/cloudstack/pull/4207

Introduction

When looking at Cloudstack logs it is difficult to accurately recognize the byte size value of logged resources. It is much easier to read the size of a resource when the byte value is expressed in KB, MB, GB, or TB. Cloudstack prints out various byte-sizes in the management server logs, agent logs, and usages records. This feature will eliminate the need to convert the values by hand when reading through the logs.

Purpose

This is the functional specification of the Human readable byte sizes feature.

Document History

VersionAuthor/ReviewerDate
1.0Darrin Hüsselmann

 

Feature Specifications

This feature adds outputting human readable byte sizes in the management server logs, agent logs, and usage records.

Instead of seeing output:
2020-07-23 15:31:58,593 DEBUG [c.c.a.t.Request] (AgentManager-Handler-12:null) (logid:) Seq 8-1863645820801253428: Processing: { Ans: , MgmtId: 52238089807, via: 8, Ver: v1, Flags: 10, [{"com.cloud.agent.api.NetworkUsageAnswer":{"routerName":"r-224-VM","bytesSent":"106496","bytesReceived":"0","result":"true","details":"","wait":"0",}}] }

The KB, MB and GB values will be printed out:

2020-07-23 15:31:58,593 DEBUG [c.c.a.t.Request] (AgentManager-Handler-12:null) (logid:) Seq 8-1863645820801253428: Processing: { Ans: , MgmtId: 52238089807, via: 8, Ver: v1, Flags: 10, [{"com.cloud.agent.api.NetworkUsageAnswer":{"routerName":"r-224-VM","bytesSent":"(104.00 KB) 106496","bytesReceived":"(0 bytes) 0","result":"true","details":"","wait":"0",}}] }

Architecture and Design description

A non-dynamic global setting is added (display.human.readable.sizes) to control switching this feature on and off, it is on by default. This setting is sent to the agent on connection and is only read from the database when the management server is started up.

Command and Answers are logged when sent between the management server and the agent. The json representation of these objects is intercepted and specific fields are matched and converted before being printed to the logs. The objects themselves are not modified.


  • No labels