Skip to content

Instantly share code, notes, and snippets.

View stympy's full-sized avatar

Benjamin Curtis stympy

View GitHub Profile
@stympy
stympy / honeybadger.rb
Created February 5, 2026 11:06
Less-sensitive fingerprint
PROJECT_ROOT = Regexp.new(/\A\[PROJECT_ROOT\]/)
Honeybadger.configure do |config|
config.before_notify do |notice|
location = begin
Hash(notice.backtrace.find { |l| PROJECT_ROOT.match(l["file"].to_s) } || notice.backtrace.first)
rescue
{}
end
@stympy
stympy / docker.md
Created February 4, 2026 21:45
Send Docker logs to Insights

You can use Vector with its docker_logs source to collect logs from your Docker containers and send them to Honeybadger Insights. This example collects logs from all running containers:

# Put this in vector.yaml
sources:
  docker:
    type: "docker_logs"
@stympy
stympy / dashboard.yaml
Created January 29, 2026 17:57
Honeybadger Insights dashboard for ActiveJob
---
title: ActiveJob
widgets:
- id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
type: insights_vis
grid:
x: 0
"y": 0
w: 2
h: 3
@stympy
stympy / commands.sh
Last active January 22, 2026 21:15
systemd config for Honeybadger CLI agent
#!/bin/bash
chmod -R go-rw /etc/honeybadger
useradd --system --home /var/lib/honeybadger --shell /usr/sbin/nologin honeybadger
mkdir -p /var/lib/honeybadger /var/log/honeybadger
chown -R honeybadger:honeybadger /var/lib/honeybadger /var/log/honeybadger
systemctl daemon-reexec
systemctl daemon-reload
systemctl enable honeybadger
systemctl start honeybadger
Honeybadger.configure do |config|
config.before_event do |event|
event.halt! unless event.event_type == "process_action.action_controller"
event.halt! unless event[:duration] > 1.0
end
end
@stympy
stympy / honeybadger.rb
Last active June 16, 2025 14:55
Adding context to events the hard way
# config/initializers/honeybadger.rb
Honeybadger.configure do |config|
config.before_event do |event|
event.payload.update(Honeybadger.get_context.slice(:user_id, :tenant_id))
end
end
@stympy
stympy / honeybadger.rb
Created June 3, 2025 20:48
Add tags to Honeybadger errors
# config/initializers/honeybadger.rb
# See https://docs.honeybadger.io/lib/ruby/gem-reference/configuration/#changing-notice-data for more info
Honeybadger.configure do |config|
config.before_notify do |notice|
additional_tags =
case notice.backtrace.lines.first&.file
when /stripe\.rb/
["payment"]
else
[]
@stympy
stympy / honeybadger.rb
Created March 21, 2025 21:33
Sampling events to send to Honeybadger Insights
# config/initializers/honeybadger.rb
require "zlib"
PERCENT_TO_SEND = 10
Honeybadger.configure do |config|
config.before_event do |event|
if event[:request_id] # Send all events for a given request
event.halt! unless Zlib.crc32(event[:request_id].to_s) % 100 < PERCENT_TO_SEND
@stympy
stympy / cloud-init.yaml
Created March 10, 2025 11:58 — forked from NatElkins/cloud-init.yaml
cloud-init script for VPS
#cloud-config
# Enable automatic package updates and upgrades during cloud-init execution
package_update: true
package_upgrade: true
packages:
# Security and Hardening
- ufw
- fail2ban
@stympy
stympy / aws.yml
Last active March 4, 2025 15:21
Loading multiple encrypted credentials files in Rails
aws:
access_key_id: 123
secret_access_key: 456