cortex icon indicating copy to clipboard operation
cortex copied to clipboard

Remove surplus sort of labels in Ingester

Open bboreham opened this issue 6 years ago • 5 comments

This is not a documented feature of the remote write protocol; it happens to be the way Prometheus 2 works but Prometheus 1 didn't send labels sorted.

https://github.com/cortexproject/cortex/blob/f91f757e97b29d96e0ede41c4a2aeb6687e4005f/pkg/distributor/distributor.go#L252-L253

If we decide Cortex has this requirement we should document it and remove the surplus Sort() here:

https://github.com/cortexproject/cortex/blob/f91f757e97b29d96e0ede41c4a2aeb6687e4005f/pkg/ingester/index/index.go#L143

bboreham avatar Dec 13 '19 08:12 bboreham

This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 11 '20 09:02 stale[bot]

I don't think this should be closed.

bboreham avatar Feb 11 '20 10:02 bboreham

Distributor now sorts labels, if they are not sorted (most of the time they are). https://github.com/cortexproject/cortex/pull/1964

pstibrany avatar Feb 11 '20 10:02 pstibrany

This is not a documented feature of the remote write protocol; it happens to be the way Prometheus 2 works but Prometheus 1 didn't send labels sorted.

https://github.com/cortexproject/cortex/blob/f91f757e97b29d96e0ede41c4a2aeb6687e4005f/pkg/distributor/distributor.go#L252-L253

Btw, this checked didn't work before (it never set lastLabelName to anything else other than ""), which is why I started to look at it.

pstibrany avatar Feb 11 '20 11:02 pstibrany

All sorting after distributor can be removed. Code needs to be checked for such places.

pstibrany avatar Sep 10 '20 15:09 pstibrany

Closing this issue as chunk engine has been removed from Cortex.

yeya24 avatar Jul 12 '24 21:07 yeya24