roundInterval
Description
Returns an interval rounded down to a specified precision. All time units smaller than the specified timeunit are zeroed out.
Syntax
Like many functions in DataPrime, roundInterval supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| interval | interval | true | The interval to round |
| scale | timeunit | true | The unit to round to, zeroing out smaller units |
Example
Use case: Bucket intervals into whole hours
Spans contain a duration interval in $m - the metadata. Use roundInterval to reduce precision to hours, then format and group by these buckets.
Example data
{ "duration": "2h10m15s", ... },
{ "duration": "3h8m15s", ... },
{ "duration": "5d2h22m46s", ... },
{ "duration": "53m15s", ... }
Example query
Example output
{ "duration": "2h10m15s", "time_bucket": "2h", ... },
{ "duration": "5d2h22m46s", "time_bucket": "5d2h", ... },
{ "duration": "3h10m15s", "time_bucket": "3h", ... },
{ "duration": "53m15s", "time_bucket": "0ns", ... }
Theme
Light