-
Notifications
You must be signed in to change notification settings - Fork 91
Description
Right now the metric handles are not specially typed, they are just uint32s. In order to make the metric API clearer and reduce the likelihood of it being accidentally misused, the Add* functions should return typed handles, e.g. metrics.CounterHandle. The corresponding functions to record measurements will change to accept only their typed handles. This will apply to Counters, Gauges, and Histograms, each with their own types.
Of course this does not prevent someone from explicitly misusing the API, but it does prevent someone from e.g. trying to increment a counter using a gauge ID accidentally, which can crash the program.
The vast majority of code should not be affected by this change, as they should mostly be using the Add* methods in var blocks and then using those in the code below.