ShieldPress

shieldpress-tracker for Ruby

Monitoring, performance and application-security telemetry for Ruby 2.7+, Rack and Rails. It uses only Ruby standard-library dependencies.

Dashboard: https://shieldpress.net/

Install

gem install shieldpress-tracker

Quick start

require 'shieldpress_tracker'

tracker = ShieldPress.init(
  api_key: 'YOUR_SHIELDPRESS_API_KEY',
  site_id: 'auto',
  app_name: 'my-ruby-app'
)

Configuration can also use SHIELDPRESS_API_KEY, SHIELDPRESS_SITE_ID, SHIELDPRESS_API_URL, SHIELDPRESS_APP_NAME and SHIELDPRESS_APP_VERSION environment variables.

Rack

use ShieldPressTracker::Middleware, ShieldPress.instance
run MyApp

Rails automatically adds the Rack middleware when ShieldPress.init runs from an initializer.

Manual instrumentation

tracker.record_request(path: '/orders', method: 'POST', status_code: 201, duration_ms: 42.5)
tracker.capture_error(StandardError.new('Invalid order'), order_id: 123)
tracker.analyze_request(url: '/login', method: 'POST', headers: headers, body: body, ip: '203.0.113.2')
tracker.record_auth_failure(ip: '203.0.113.2', url: '/login', reason: 'bad password')
tracker.record_rate_limit(ip: '203.0.113.2', url: '/api')
tracker.record_cors_violation(ip: '203.0.113.2', origin: 'https://untrusted.example', url: '/api')
tracker.flush
tracker.stop

Options: api_url, report_interval, system_metrics, http_tracking, error_tracking, security_tracking, dep_audit, dep_audit_interval, runtime_metrics, env_security, heartbeat, app_version, environment, tags, ignore_paths, max_error_buffer, max_security_buffer, and debug.

The SDK never raises a network/reporting failure into the host application. Reports are sent to /api/tracker/report with Bearer authentication.