-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store Prometheus labels as a slice instead of a map #3422
Store Prometheus labels as a slice instead of a map #3422
Conversation
This should be more efficient in general, and will let us skip target hashing completely in the future.
Amazing work on that @swiatekm 👏🏽 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hey @swiatekm anything I can do to help with this change? |
@nicolastakashi I'm just waiting for another approver review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description:
Store labels for targets in the target allocator the same way Prometheus itself does - as a key+value list of type
labels.Labels
instead of amodel.Labelset
map. The former is what relabelling acts on, so we get to skip the conversion there, and building the list is faster as well. This makes looking up values of specific labels slower, but we don't really do that outside of determining the Node name.I've modified the benchmark to actually drop half the targets during relabelling to make it more realistic.
Benchstat shows some nice gains: