Project

postdeploy

0.0
The project is in a healthy, maintained state
Captures errors and operational signals for PostDeploy's production toolkit ingest endpoint, with an optional Rails railtie for automatic unhandled-exception capture.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 7.1
~> 3.0
~> 2.1
~> 7.1
~> 13.0
~> 3.13
~> 7.3
~> 3.24
 Project Readme

postdeploy

Error reporting for PostDeploy Observe. Ruby and Rails.

Zero runtime dependencies: Net::HTTP and the stdlib only.

Setup guide: Ruby and Rails error tracking.

Install

# Gemfile
gem "postdeploy"

Set POSTDEPLOY_API_KEY (an ingest key with the ingest scope).

Rails

Add the gem. The railtie installs PostDeploy::RackMiddleware and captures unhandled exceptions. No further wiring is required.

Identify the current user in a before_action:

PostDeploy.set_user(id: user.id, email: user.email)
PostDeploy.set_tag("org_id", org.id)

Capture

begin
  risky_operation!
rescue => e
  PostDeploy.capture_exception(e, context: { order_id: order.id })
end

PostDeploy.capture_message("low disk space", level: "warning")

Both methods return an err_ event id and never raise.

Heartbeat

PostDeploy.heartbeat(token)
PostDeploy.heartbeat(token, state: "fail", ping_id: "nightly-2026-08-30")

Heartbeat calls never raise. Each call makes at most two attempts and reuses one ping_id across retries. The server deduplicates a supplied ID per monitor for 24 hours. Transport failures, 408, 429, and 5xx responses retry only. Each attempt is bounded to five seconds. Delta-seconds Retry-After is capped at two seconds; other retries use jittered backoff around 500ms. Diagnostics never include the full heartbeat token.

Plain Rack

use PostDeploy::RackMiddleware

Config

The key is read from POSTDEPLOY_API_KEY by default. It is never logged.

PostDeploy.configure do |config|
  config.environment = "production"
  config.release = ENV["GIT_SHA"]
  config.before_send = ->(item) { item }
end

before_send receives the built item. Return nil to drop it. A raise sends the original item.

Tests

PostDeploy.configure { |c| c.test_mode = true }

PostDeploy.capture_exception(error)
PostDeploy.flush
item = PostDeploy::Testing.events.first

Nothing hits the network. Set config.enabled = false to disable capture.

Development

cd sdks/ruby
bundle install
export ALPLUS_CONTRACT_DIR=../../sdks/contract
bundle exec rspec