12:28:09 GMT Hey everyone. I'm confused how to use redis for metrics. I want to do a RPM stat. 12:28:23 GMT I am trying to use a key and set an expiration, but it doesn't seem to ever expire 12:28:33 GMT rpush key, value 12:28:42 GMT expire key 1 minute 12:29:09 GMT do you keep adding new stuff? 12:29:47 GMT the expiry applies to the key itself, styles, not to the elements you push into it 12:30:15 GMT Ok, so a key being a list of items 12:30:19 GMT So I don't want al ist then, right? 12:30:25 GMT a list* 12:31:03 GMT redis is bad for time series, fyi 12:31:31 GMT I just want to use it for a few simple ones 12:31:41 GMT Nothing crazy. I've looked at OpenTDB and other things 12:31:52 GMT I don't want the data long term either, just for the last like 15 minutes type 12:31:52 GMT you could create a key per minute 12:32:07 GMT What if I wanted to do an average of the RPM? 12:32:28 GMT over the last 15 minutes? 12:32:54 GMT Yeah 12:33:56 GMT you could discreetize your data into keys, one per minute, and to get the avg over 15 minutes query the 'last' 15 keys and average their value 12:34:59 GMT minus, could I do like drone:rpm:hour:minute:second 387 12:35:02 GMT the averaging could be done client-side or with a lua script 12:35:16 GMT then do like range drone:rpm:hour 15 ? 12:35:24 GMT no 12:35:33 GMT well, as long as you know the key names you can 12:35:50 GMT wildcard-style matching doesn't work well with redis 12:35:55 GMT ah ok good to know 12:36:13 GMT so I should just make each one of those keys and query them though? 12:36:21 GMT KEYS/SCAN can do that, but they're O(n) with n being the number of all keys in the DB 12:36:54 GMT yes, you could, but it's not really optimal 12:37:41 GMT depending on the amount you throw at it the one second resolution could be a problem 12:37:53 GMT humm 12:37:58 GMT with one second resolution you need to do 900 queries to redis to get the avg 12:38:00 GMT This is actually a pain in the butt lol 12:38:59 GMT maybe you can pull a stunt with sorted sets and using timestamps as scores. but that requires one entry per "hit" pretty much 12:39:36 GMT What about doing a incrby on a key that's the time like rpm:hour:minute:second 12:39:43 GMT then set that whole key to expire after the total duration 12:40:02 GMT and if I want to look it up, like you said, just range over the keys and add them up 12:40:09 GMT yeah, that's what we were talking about before. works but 900 queries for an avg 12:40:29 GMT kk 12:40:32 GMT I'll test that now 12:40:36 GMT thanks minus 12:40:42 GMT i mean it's totally not a problem if you only have a handful of those stats and query them every few seconds 12:41:40 GMT Can you "search" for keys? 12:43:06 GMT ah scan ok 12:44:49 GMT it's working, thanks 16:27:30 GMT hi 16:27:35 GMT how do people monitor redis? 16:43:45 GMT not at all here. the application does implicitly 16:44:30 GMT how do you tell if there's a problem? 16:45:05 GMT when the application fails of course 16:45:15 GMT minus: :o 16:45:28 GMT i feel you arent taking this very seriously 16:45:30 GMT 100% dependent on redis here 16:46:29 GMT well, HAProxy executes PINGs and sentinel does failovering 16:46:34 GMT question. According to the documentation the SCAN command may return any given element multiple times. Does this happen under some concrete conditions or is there always a chance of getting a duplicate? 16:47:06 GMT minus: how do you know if there has been a problem? 16:47:38 GMT i guess i don't, good point 17:33:42 GMT any ideas on my previous question with the SCAN command? 17:34:32 GMT minus: sounds bad 17:34:48 GMT eugecm: assumption: when the key contents changed. 17:35:07 GMT rob_: kinda, yeah, but it's a managed service, so everything is fine 17:35:20 GMT managed by who? 17:35:30 GMT our hoster 17:35:33 GMT minus: fair enough, I guess the function will have to be idempotent then 17:35:35 GMT ok 17:35:42 GMT do they monitor it for you then? 17:35:44 GMT minus: thanks 17:36:04 GMT rob_: i hope so, lol 17:36:24 GMT :| 23:40:21 GMT hello everyone, I'm new with lua scripts, if timestamps is a null key, what does redis.call("LPOP", "timestamps") returns? 23:40:36 GMT nil? so I can check that return value with nil? like `ret == nil` in lua? 23:41:31 GMT doing `local next_queue = redis.call("LPOP", "timestamps")` seems it never enters `if next_queue == nil then` even when it's empty 23:42:24 GMT oh nvm, it returns false