-
-
Save inthecloud247/6d90d4f7ab3929408f5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define these shard spaces | |
shardSpaces = [ | |
{name: "raw", retention: "4h"}, | |
{name: "week", retention: "7d"}, | |
{name: "month", retention: "30d"}, | |
{name: "year", retention: "365d"}, | |
{name: "keep", retention: "inf"} | |
] | |
// apply these rules for mapping data to shard spaces | |
rules = [{ | |
"database": "metricsDB", | |
"mappings": [ | |
{"space": "week", "regex": "^week.*"}, | |
{"space": "month", "regex": "^month.*"}, | |
{"space": "year", "regex": "^year.*"}, | |
{"space": "keep", "regex": "^keep.*"}, | |
{"space": "raw", "regex": ".*"} | |
] | |
}] | |
// there can be only one rule set per database | |
// when data comes into a database, the rules will be | |
// evaluated in order | |
// now define some continuous queries for example: | |
// select percentile(value, 90) from raw.response_times | |
// group by time(5m), controller_action | |
// into week.response_times.percentile.90.5m | |
// select count(user_id), user_id as raw.event_count | |
// from user_events | |
// group by time(5m), user_id | |
// into week.user_events.count.5m | |
// select sum(event_count) as event_count, user_id | |
// from week.user_events.count.5m | |
// group by time(1h), user_id | |
// into month.user_events.count.1h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment