:new_moon_with_face:

Collecting Prometheus metrics for Python services behind gunicorn using Consul

Prometheus is a great metrics monitoring system and works particularly well with Go where a web application is usually a single process behind nginx. With Python and gunicorn it gets quite complicated as there are several instances of the same web app. If you use gunicorn and follow the default instructions on integrating the Python client for Prometheus you will end up with useless metrics as gunicorn will load balance the /metrics endpoint between each gunicorn worker.

Read more →

Unmarshal Go database query results into gRPC/protobuf structs

gRPC gRPC is an incredibly powerful alternative to JSON-RPC and all kinds of custom RESTful APIs we invent for microservice communication. You define message types and service methods in an IDL called Protocol Buffers. These protobuf files are used to generate client and server code for your target language. Protobuf message types get transpiled to structs in Go. If you use something like sqlx to query a database and return the result over gRPC you would have to add custom tags to your structs to specify which struct fields correspond to which database fields.

Read more →

Export all Slack logs as a non-admin user

Have you ever wanted to export all Slack logs for your team but you are just too awkward to ask one of your team admins to export everything properly? Now there is a solution. I have written a Python script called slack-exporter (I’m good with original names as you can see) that allows you to do exactly that but as a regular user with no access to Slack’s official export page.

Read more →