Driving along a winding road, up the side of a hill.
It is deepening dusk, and the road curves upwards to the right.
The mountain side has some trees (pines) and short grass. It’s cold, maybe close to freezing.
The car is cold, the windscreen is still a small bit fogged.
The surface of the road changes to closely packed upturned feet, with little faces on the sole (just below the toes). They are all staring at you without speaking, as your tires loose grip on the shiny upturned flesh. Your car skids, careens across the road, and out over the edge of the abyss.
As the car starts tipping end over end, rapidly approaching the ground, all you can think of is the road made of upturned feet.
I just got caught by a “reliable” internal service which started to give timeouts.
I never configured a timeout on the connection (default was many minutes) which jammed the whole program.
It’s important to set aggressive timeouts in prod, better to error and figure out a way to accommodate the error than just wait.
Perhaps the next step is to make my program internally defensive in order to combat my poor coding skills.
Given:
summaryList = [{"Event Name": "Pod_Service_MTTR_Notify", "Count": 1}, {"Event Name": "Pod_Service_No_2_alert", "Count": 20}]
if summaryList:
summaryTable = PrettyTable(summaryList[0])
for i in summaryList:
summaryTable.add_row(i.values())
My main source of data… jira service desk… cannot be trusted. Oh yes, 90% of the time it acts sane, but once in a while, someone misconfigures a big panda alert and we get 1000 new incidents in moments.
My colleague got flooded with pager duties and emails one Saturday, and I’m sure it made him cry. I need to rate limit these actions.
My plan is to use incr function to increment a redis key. The idea is that you create a new key every x seconds, with an expiry (equal to x) and then when you increment redis will respond with the current value, so you can just test the if loop.
First things first. I know how to do something every second int(time)) but every 10 minutes?
from time import time, sleep
while True:
everyXSeconds = 10
curTime = int(time())
key = curTime - curTime % everyXSeconds
print(key)
sleep(1)
I’m only calling time() once because calling time() twice in the mod actually give different nanosecond values… and I just know I am going to hit some corner case where that crosses a second boundary and messes up EVERYTHING
BUT… the above is actually crap and not needed at all. That is a crap way to rate limit cause, for example, if I am trying to stop an email flood it will still send 10 emails every X seconds. As in, the count will be reset every X seconds.
To me the following makes a bit more sense:
while True:
curTime = time()
print(f"curTime is {curTime}")
everyXSeconds = 10
rateBeginTime = curTime - everyXSeconds
count = red.zcount(queueName, rateBeginTime, curTime)
print(f"current hit queue is :{count}")
limitMap = {curTime: curTime}
red.zadd(queueName, limitMap)
sleep(1)
remove = red.zremrangebyscore(queueName, 0, rateBeginTime)
print(f"removed {remove} keys")
So thats just what I used to test…. but basically you are using a sorted list and adding and removing as needed
Cryptomnicon (spoiler warning)
It has been a long time since I felt the need to write about a book I read.
Particular items of note:
Ityme A: There are some very funny bits in it. I got a good chuckle from some bits of it. It was a bit more funny than termination shock.
Ityme B: It doesn’t shy away from sex. It is still a bit awkward (as anything from an American/ British writer is going to be really) but better than most writers of this ilk.
Ityme C: I liked the Andrew Lobe bit at the end. I actually forgot he was the lawyer until I google him afterwards… A passionate Lawyer indeed. Yes some of the criticism of the character could be valid but when taken as part of the book as a whole I think it fits in nicely in it’s current treatment.
Ityme D: I read numerous reviews before hand saying the first half of the book didn’t have a plot. It clearly does, it’s just temporally non-contiguous .
Ityme E: It is a good book. I also enjoyed Termination shock without realising it was the same author. I stopped “reading” (listening) to the vagabond one but now I have more of a sense of Stephensons style I will go back to it as I find it enjoyable.
Ityme F: The books do not come to an abrupt stop; to quote one person ,”It is as if the publisher called him and said “ok finish up, we need the manuscript tomorrow”. The story has a lovely natural ending, and I found it most satisfactory (I imagine it is hard to end an epic)
Ityme G: I want some of the websites and servers mentioned in the book to still work!
Friday night jungle is MASSIVE. https://www.youtube.com/watch?v=OICeFYUu0j0
This goes out to all the chocolate mouses in the building….. Hold onn!
XXX and other such texts.
A Marlon Brando of a whale shat on me today.
What are the cheeky elves going to do tonight?
Father passed away
Father passed away there after a struggle with cancer.
I’m still in it, but how few people have contacted me to send condolences is mental. Is it cause I’m not on Facebook?
The people I work with, most of whom I have never even met in real life, sent the nicest messages.
My team has a great culture the kinda sucks people into it, it’s nice.
I’m still in it, and I guess this is my outlet for self indulgence…
Look, I’m not, a professional let us say. Sometimes I work in prod shell.
In order to keep myself aware of same, make this little change to the .tmux file so you always have a visual queue that you are in prod:
# Status Bar
set -g status-bg red
(as opposed to black)