Open yeya24 opened 2 years ago
Thanks for digging this up! Anything that helps with DB performance is high priority for us. I'll make sure we investigate this in our upcoming release and get this scale tested.
Hi @yeya24 this remains high priority for us but I underestimated how much work this is; don't think we'll be able to get to this until v1.100 scheduled for January since there's a large chunk of APIs to swap. This still remains important to us, though.
This issue has been marked as stale because it has been open for 180 days with no activity. Please remove the stale label or comment or this issue will be closed in 5 days.
Not stale
This issue has been marked as stale because it has been open for 360 days with no activity. Please remove the stale label or comment or this issue will be closed in 5 days.
Still not stale
Overview
Currently, opencost has some queries that only require metadata like labels, annotations, etc. However, these queries are sent using the Prometheus Query API. The Query API will touch not only the labels, but also chunks. This affect the performance of downstream metrics stores like Cortex, Prometheus, Mimir, Thanos, etc.
All the queries are listed https://github.com/opencost/opencost/blob/develop/pkg/costmodel/allocation.go#L46-L56.
Those metrics only have value
1
or0
and we are not using the calculated results anywhere, so things likeavg_over_time
doesn't make sense. Using https://prometheus.io/docs/prometheus/latest/querying/api/#finding-series-by-label-matchers API is probably a better option.