Using https://godoc.org/github.com/prometheus/client_golang/prometheus I created a custom Collector that reads Stats from sql.DB and gives them out as Prometheus metrics.
Learned today: Go templates
I built a library for loading configuration files that are actually Go templates, with some custom template functions for including values from other configuration files and loading secrets from files mounted by docker secrets.
If it turns out to be usable maybe I can open-source it some day, but for now it is proprietary.
Experiences with Go
For a few months now, I’ve been programming mostly in Go. Go is a programming language developed by Google, some kind of modern version of C.
Instead of listing here all the findings, I’ll just point to the excellent summary by Sylvain Vallez. With my couple of months of experience in Go, I can fully agree with Sylvain’s points.
When I think of Go, the first thing that comes to my mind is the error handling. Probably half of my code is for error handling:
if err != nil { return err }
But overall I’m quite satisfied with Go. It gets the job done, and I like statically typed languages. If it had generics, I might even enjoy using it.
Introduction to Go language
Today I attended an event by Talented.fi where Henri Koski introduced Go language and how to create a microservice with it in Kubernetes. Looks like a very good language, and a good alternative for languages like C or JavaScript as in Node.js.