Adding custom fields to Honeycomb traces in Rails by writing a Rack middleware

In our Rails app, installing the Honeycomb beeline magically gave us traces of all HTTP requests, with dozens of useful fields like ‘request.path’ and ‘response.status_code’. I really wanted the request verb (GET or POST) and I couldn’t find that. (It’s there, in ‘request.method’, I missed it. But still, it’s useful to know how to a … Read moreAdding custom fields to Honeycomb traces in Rails by writing a Rack middleware

Honeycomb in Rails with separate dev and production events

Honeycomb made it suuuuuper easy to see traces of HTTP requests hitting my app. Right from my computer! We installed one gem, did one rails generate from a cut-and-paste their dataset creation page gave me. Start up rails server, hit http://localhost:3000, and boom! A thing on a graph in Honeycomb! That was cool. Except, um, … Read moreHoneycomb in Rails with separate dev and production events

Honeycomb in Rails without hard-coding the API key

Today we hooked up Honeycomb to an app for the first time! It was easy and fun! Then we configured it so that we don’t have to commit our apikey. It’s a public repo. Anyone could grab our API key and send spurious events to our Honeycomb datasets, screwing up our information and costing us … Read moreHoneycomb in Rails without hard-coding the API key

TDD with generative testing: an example in Ruby

Say I’m in retail, and the marketing team has an app that helps them evaluate the sales of various items. I’m working on a web service that, given an item, tells them how many purchases were influenced by various advertising channels: the mobile app, web ads, and spam email. The service will look up item … Read moreTDD with generative testing: an example in Ruby

Aqueductron – toying with dataflow in Ruby

I love playing with Ruby because it lets me express concepts clearly[1]. In my aqueductron gem, two concepts are expressed. It’s about processing data, and about code modifying code, all without modifying anything[2]. The metaphor of Aqueductron is an aqueduct. Data is the water, taking the form of droplets flowing through the ducts. Each piece of duct … Read moreAqueductron – toying with dataflow in Ruby

Passing functions in Ruby: harder than it looks

People say, “Oh, Ruby has functional programming! We pass blocks around all the time!” I’m sorry to inform you: Ruby blocks are not first-class functions. Functional programming is so called because we find it useful to pass functions as values. When we do that, we expect that the function can be called and: it’ll get … Read morePassing functions in Ruby: harder than it looks