metrics
metrics copied to clipboard
add an efficient labels serializer
trafficstars
What has been done? Why? What problem is being solved?
I found out that observe method works slow. Further investigations showed that make_key function sorts keys every run time. make_key is being called often during, for instance, hist:observe. To optimize this case and both keep the default behavior, I propose two things:
- Allow user to override
labels_pairsserialization scheme with__metrics_make_keymeta-method. If it is supplied, it would be used, otherwise the default sorting scheme would be used; - Provide precaching labels serializer. It would order the labels properly on the client side, and only concat pairs on the metrics side. The complexity is linear then.
I didn't forget about
- [x] Tests
- [x] Changelog
- [ ] Documentation (README and rst) (don't think I should alter it for such a small api?)
- [ ] Rockspec and rpm spec (I don't really know what to add here)
This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days