How we configured OpenTelemetry logs in Rails

SixPatterns shares how they added OpenTelemetry log export to a Rails app without a vendor lock-in, bypassing the OpenTelemetry Collector to send logs directly to Grafana Cloud. They detail the required gems, environment variables, and an initializer, plus two Ruby SDK bugs they found and fixed upstream: a dropped base path in the OTLP endpoint and mishandling of HTTP 204 responses.
A Collector is still the better choice if you need buffering, sampling, or scrubbing outside the app.
- willcodeforfoo
Would love to see what people are doing to visualize in Grafana.
- jasondjk
I’d contend having user behaviour logged directly into your monolithic app db using the ahoy gem instead of some external grafana/etc system is much more powerful because then you can point an agent at a copy of your database and it can wire together all of your operational and business metrics at the same time without having to try and say, connect a user profile between grafana/salesforce/hubspot/intercom etc. eg. “Claude, tell me which customers activate and convert and which churn and why and make a plan to optimise the funnel”. Hooking that up has never been easier https://insidertrades.directory/built-with-rails/ahoy-blazer... ie. build, don’t buy in the age of AI