How to get accurately the bandwidth consumption (download/upload) per CID

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.

There is no way I know of to do this. cidtrack looks interesting. It looks like some manual adapting of Kubo will be necessary. You can always query cumulative size for pinned objects with ipfs dag stat I think.

1 Like

thanks @hector for your answer.
This issue IPFS Bandwidth Metrics and Logging enhancements · Issue #14 · ipfs/roadmap · GitHub suggests that this could be implemented officially, however it is still open for about 4 years now and I can’t find any related progress. do you have any idea if is it planned or dropped? maybe any progress happened since then?

I don’t think this is on anyone’s radar now @sameh-farouk .

1 Like