juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.04k stars 1.19k forks source link

fix(analytics): use HashSet to represent the returned metrics #5095

Closed lsampras closed 9 hours ago

lsampras commented 1 week ago

Currently we have 2 sources for analytics Clickhouse & Sqlx Along with this we have a combined mode which helps compare for any differences in these results However since currently we return a vector of results this causes an mismatch warning if the order is changed, instead we should use a HashSet to store & compare these values.

https://github.com/juspay/hyperswitch/blob/d4dba55fedc37ba9d1d54d28456ca17851ab9881/crates/analytics/src/api_event/metrics.rs#L41-L50

we can also add a Counter metric to determine whenever these metrics are incorrect.