penglongli / gin-metrics

gin-gonic/gin metrics for prometheus.
MIT License
255 stars 61 forks source link

Bloom filter uses heap and seems unused #29

Closed ocampeau closed 2 years ago

ocampeau commented 2 years ago

I used pprof to investigate memory usage (heap) in my application, and I noticed that the bloomFilter is using approx 4Mb of heap.

By looking at the code, it seems the bloomFilter is of no use at all.

It is used in ginmetrics/middlwares.go, to store IP addresses, but those IPs seems to be never used.

Unless there is another usage which I haven't understand, would it be possible to remove the bloomFilter from this lib? It would free 4Mb of heap usage on every application that uses this library.

ocampeau commented 2 years ago

I can submit a PR if the maintainers of this project don't have time for it.

ocampeau commented 2 years ago

It is being used after all. I still haver an issue with the bloomFilter, but it is not related to the title of this issue, so I will open a new one and close this one.