Observe Performance Cookbook: Use Interval for Ephemeral Things¶
Problem¶
Using a dataset with ephemeral resources is taking a long time or using a lot of query credits.
Solution¶
Copy the resource dataset and modify it to be an Interval dataset instead by replacing make_resource
with make_interval
.
Explanation¶
In general, Resources should be used to model “things that last a long time and may change state”, like Host, Container, or Customer. Intervals should be used to model “things that last a short period of time and do not change state”, like User Sessions, Financial Transactions, or API Calls.
For example, you may want to model a customer request dataset where each customer request is made of a few events and only lasts for a few minutes. These requests can be modeled using the make_interval
verb, which produces an interval dataset.
make interval options(expiry:10s), valid_from, valid_to
Note that older datasets may have used make_session
to produce Interval datasets instead:
make_session
options(expiry:10s),
request_name:any_not_null(name),
request_tags:any_not_null(tags),
group_by(request_id)