It is for work. The idea is that we aggregate some raw data and optionally preprocess it to provide some useful metrics for analytics. We expose a mini dsl layer that is used for query building, so the users don’t really know what’s behind it.
This allows easy customization of charts and doing EDA.
We have a pipeline that is constantly pushing new data into the system.
Since users are querying the db as they like, we need to have some limits in terms of number of series that. Maybe I misunderstand what SLIMIT
does, but limit in flux allows us to limit the number of data points in each series, but ideally I would like to limit the number of the series themself.
So the use case is, if for some query the users would get 100k lines, I would like to limit it to 500 max per query, so the data is still rendered, but we don’t stress the db that much.
We can handle this on the application side, but ideally I would like to avoid it for now.
For better understanding:
We look at some events to create our db:
tags [shop: s1, branch_office: b1, item: i1], fields[price: 10, quantity: 5]
tags[shop: s1, branch_office: b1, item: i2], fields[price: 100, quantity: 1]
tags[shop: s1, branch_office: b2, item: i1], fields[price: 9.5, quantity: 5]
tags[shop: s2, branch_office: b1, item: i1], fields[price: 8, quantity: 10]
tags[shop: s2, branch_office: b1, item: i3], fields[price: 1, quantity: 10]
We would aggregate this data based on time, so that we can get metrics on different levels:
- metrics for items aggregated (avg price, total quantity, avg quantity…)
- metrics for branch offices (total sales for branch office…)
- metrics for shops
With the dsl, you can easily define what you want to render on the charts:
- Price of item1 → a line for each item1 price (in each branch office of a shop)
- Quantity of item1 in all shops → a line for each shop
- Sales for all branches of a shop → a line for each branch of the specified shop
- …
Allows great flexibility on different levels of granularity. The example is made up, so might not make complete sense, but I hope it paints a clear enough picture.
Is there a way to achieve this?