Monitoring convergence
Nov 20, 2022
Where possible, I like to build systems around convergence.
These systems generally look something like:
Tick on some regular interval (10 minutes, 1 hour, etc) Update the view of the world (discover new data, observe a value, etc) Act on the updated view, possibly comparing to the previous view (stop some servers, process newly discovered data, etc) For example, an auto scaling group would continually check instance health, load, etc, and converge on the desired or optimal number of servers by starting new ones or stopping existing ones.
It seems like Twitter may not be around much longer. Even if does stay around, it’s not likely to be a place I want to be anymore.
Like many folks, I decided to dip into the Fediverse. Using Mastodon seemed like a good first step. I set up an account on mastodon.social but quickly realized it was overwhelmed. There were other servers to join but I wanted to run my own.
Summary Starting in Go 1.201, DNS lookups when running on macOS will be done via the system instead of via Go’s built-in resolver. That’s even when cgo is not available, such as when cross-compiling from Linux.
That should reduce surprises for people using tools cross-compiled for macOS from Linux, such as CLIs like terraform and kubectl. It should also make it easier for developers of those tools as building on macOS may no longer be necessary.
Halifax has a systemic road safety problem. One way it manifests is people driving too fast, especially on residential streets.
Recently, Halifax Regional Council mostly approved their 2021 capital budget. It includes $1 million for traffic calming and the final budget may include $1 million more. Read more about that here or here.
The city publishes a ranked list of approved requests. Not all requests are approved due to rules that contribute to the systemic problem.
As part of Heroku Private Spaces we attach extra Elastic Network Interfaces to instances, and we do that in Go with aws-sdk-go.
The process isn’t the most idempotent and we recently discovered we were occasionally leaking ENIs. This could happen if we created an ENI and then encountered an error later in the process, such as when attaching it to an instance. I set out this morning to find a better way.
One of my favorite localized Go refactorings is reducing nesting by using return as early as possible. Take this example, based on a recently-refactored function at Heroku:
func example() error { if err := start(); err != nil { existing, err := fetchExisting() if err != nil { return err } if existing.IsWorking() { return nil } else { return errors.New("found existing but it's not working") } } return nil } This can be hard to follow due to nesting inside if .
At Heroku we use Travis CI to run project tests on push to GitHub. While Travis CI offers PostgreSQL in their environment, it’s version 9.1. A project I’m working on recently started using PostgreSQL 9.2’s JSON data type, which 9.1 does not have.
Needing 9.2, I searched for ways to make it available in the Travis CI environment. I found guides that suggested upgrading PostgreSQL in a before_script but I didn’t have much luck with that approach.
Since July 30th, I’ve been using ledger (on GitHub) to track my personal finances. What did I use before? I’m ashamed to say nothing beyond my banks’ sites.
I stumbled upon ledger via this blog post, linked from Hacker News. It took me a while to try it, for a few reasons. First, I had a weird notion that there would be a better time in my various “fiscal cycles” to start using such a thing.