I’m not aware of any (straightforward) way/method to get the bandwidth consumption per CID from the cluster client or from the IPFS client.
I’m implementing a pinning service that uses the cluster client to pin data to a cluster of IPFS peers, I need to be able to query the cluster for information about the bandwidth consumption per CID, and the storage. for storage, I can get an IPFS shell and query the node about the recursive data size of a root CID. but I have a hard time thinking about how I can get the bandwidth-related info in an accurate way that can be used for a billing service.
I read somewhere about the possibility of getting such info by monitoring some logs, or by querying the bit swap ledger for how many times a block was requested. but none is reliable or straightforward to production use.
This was the most helpful info I was able to find:
Given that it was 2 years ago, probably a lot of things were changed/improved.