startSpan vs startActiveSpan in OpenTelemetry JS

TL;DR: startSpan is easier and measures a duration. Use it if your work won’t create any subspans. startActiveSpan requires that you pass a callback for the work in the span, and then any spans created during that work will be children of this active span. I’m instrumenting a Node.js app with OpenTelemetry, and adding some …

Read morestartSpan vs startActiveSpan in OpenTelemetry JS

Read a file with promises in TypeScript on Node

import * as fs from “fs”; import { promisify } from “util”; const content: Promise<string> = promisify(fs.readFile)(“path/to/the/file”, { encoding: “UTF-8” }) I am tired of looking that up over and over every time I want to read a file into a promise in Node using TypeScript, so here it is. Next time, bring me here, Google. The promisify call turns fs.readFile from a callback-based method to a promise-based one. promisify accepts …

Read moreRead a file with promises in TypeScript on Node

In defense of rationality and dynamic programming

Karl Popper defines rationality as: basing beliefs on logical arguments and evidence. Irrationality is everything else. He also defines comprehensive rationality as: only logical arguments and evidence are valid basis for belief. But this belief itself can only be accepted by choice or faith, so comprehensive rationality is self-contradictory. It also excludes a lot of …

Read moreIn defense of rationality and dynamic programming

Systems and context at THAT Conference

It’s all that THAT Conference is not THOSE conferences. It’s about the developer as more than a single unit: this year, in multiple ways. I talked about our team as a system — more than a system, a symmathesy. Cory House said that if you want to change your life, change your systems. As humans, our greatest power …

Read moreSystems and context at THAT Conference

Understanding Promises in JavaScript (with yarn and Legos)

TL;DR: creating a Promise splits off another path of execution, and the Promise object represents the end of that path. Calling .then adds code to the end of that path. You can think of your program’s execution as following a piece of yarn. this video illustrates the difference between a synchronous program and the same program …

Read moreUnderstanding Promises in JavaScript (with yarn and Legos)