swift-server / swift-prometheus

Prometheus client library for Swift
https://swiftpackageindex.com/swift-server/swift-prometheus
Apache License 2.0
145 stars 30 forks source link

Rename destroyMetric to unregisterMetric #102

Closed fabianfett closed 1 year ago

fabianfett commented 1 year ago

Renamed the PrometheusCollectorRegistry destroy methods to unregister. this is more in line with the Prometheus documentation:

CollectorRegistry SHOULD offer register()/unregister() functions, and a Collector SHOULD be allowed to be registered to multiple CollectorRegistrys.

Further this is more in line with what this function actually does. The metrics aren't move only types, that we can actually destroy in the method.

Also added docc comments.

fabianfett commented 1 year ago

Are you also planning to rename the make methods?

@FranzBusch No, I don't plan this. Reason: We might want to add explicit calls to register and allow create metric creation without a registry attached from the get go. However we could change the internal make implementation to do exactly that.

My goal with this is to get the API in such a shape, that we can be fully compatible with the prometheus requirements without breaking API.