This is the Ruby gem for AppSignal, an application performance monitoring (APM) service.
Directories:
bin/- Directory with executables that can be called once the Ruby gem is installedlib/- Main library codeappsignal.rb- Main module of the Ruby gemappsignal/- Library codecapistrano.rb- Capistrano integrationcheck_in/- Check-in functionalitycli/- Command Line Interface modulesconfig.rb- Configuration managementevent_formatter/- Event formatting for different frameworksextension.rb- C extension module, extended by the C extensionextension/- C extension modules in the Ruby gemhooks/- Ruby gem hooks and may contain integration codeintegrations/- Ruby gem integrations, loaded by the hooksloaders/- Ruby gem loaders, integrations manually loaded by applicationslogger.rb- Logger functionalityprobes/- Minutely probesrack/- Rack middleware for various Ruby gemsspan.rb- Tracing span API (private API)transaction.rb- Tracing transaction APIutils/- Utility modulespuma/plugin/appsignal.rb- AppSignal Puma pluginsequel/extensions/appsignal_integration.rb- AppSignal Sequel plugin placeholder
ext/- Native C extensionappsignal_extension.c- Main C extensionbase.rb- Extension installation script helpers shared between the MRI Ruby and JRuby installersextconf.rb- Extension installation script for MRI RubyRakefile- Extension installation script for JRubyagent.rb- Agent bootstrapping
spec/- RSpec test suitelib/- Unit testsintegration/- Integration testssupport/- Test helpers, matchers, shared examples, stubs and fixtures
gemfiles/- Gemfile variations used for testingresources/- Configuration templatesscript/- Development scripts
Files:
Gemfile: Additional development dependenciesRakefile: Build and development tasksappsignal.gemspec: Gem specificationbuild_matrix.yml: Build matrix configurationmono.yml: Mono release configuration
appsignal.rb: Main Ruby gem module with the public APIappsignal/helpers/instrumentation.rb: Tracing instrumentation helpersappsignal/helpers/metrics.rb: Metrics helpersappsignal/config.rb: Configuration management and validationappsignal/transaction.rb: Transaction APIappsignal/extension.rb: Interface to native C extensionappsignal/hooks/: Framework-specific instrumentation hooksappsignal/integrations/: Framework integrations (Rails, Sidekiq, etc.)appsignal/rack/: Rack middleware for web frameworks
appsignal_extension.c: C extension for performance-critical operationsextconf.rb: Extension build configurationagent.rb: Agent initialization and management
The gem supports numerous web frameworks like:
- Grape
- Hanami
- Padrino
- Rails, including:
- Action Cable
- Active Support Notifications
- Active Job, and all adapters
- Action Mailer
- Sinatra
- Webmachine
Background job libraries like:
- DelayedJob
- Resque
- Shoryuken
- Sidekiq
Database drivers like:
- DataMapper
- MongoDB
- Redis and redis-client
- Sequel
And gems like:
- Capistrano
- Excon
- Net::HTTP
- Ownership
- Passenger
- Puma
- Rake
- Unicorn
# Install dependencies
bundle install
# Install the extension
rake extension:install# Run the test suite
bundle exec rspec
# Run tests for specific framework
BUNDLE_GEMFILE=gemfiles/<gemfile>.gemfile bundle exec rspec# Install or reinstall the extension
rake extension:install
# For JRuby
cd ext && rakeThe Ruby gem includes type signatures for better IDE support and static analysis:
sig/appsignal.rbi- Sorbet type signaturessig/appsignal.rbs- RBS type signatures
To regenerate type signatures from YARD documentation:
script/generate_signaturesThis script uses sord to generate both RBI and RBS files from YARD comments in the source code.
spec/lib/: Unit tests mirroringlib/structurespec/integration/: Integration and end-to-end testsspec/support/: Test helpers, mocks, and fixtures
build_matrix.yml: CI build matrix configuration.github/workflows/ci.yml: GitHub Actions workflow (auto-generated)
Update the generated .github/workflows/ci.yml file by running the following command:
rake build_matrix:github:generateThe script to generate the .github/workflows/ci.yml file is part of the Rakefile.
- The gem includes both Ruby and Java (JRuby) versions.
- Native C extension provides performance-critical functionality.
- Extensive test matrix covers multiple Ruby versions and frameworks.
- Uses mono for automated releases and changelog management.
The Ruby gem is documented using YARD and is paired with documentation on the AppSignal documentation website at: https://docs.appsignal.com/ruby.html