GitXplorerGitXplorer
s

Nonius

public
5 stars
0 forks
3 issues

Commits

List of commits on branch main.
Verified
81afa6425b2469c89834f200dfc6ad2d76347872

Update README.md

ssupermomonga committed 3 months ago
Verified
afa8af58174d27473396a68c3d43d4e921e71fcd

readme: build from source

ssupermomonga committed 3 months ago
Unverified
0a6e408aad45453aab84e1587c8e187da689d7c9

trivial fixes

ssupermomonga committed 3 months ago
Unverified
cd1ff8feebf2ded375b31ebaf7f82ca8d3413461

fix code of conduct

ssupermomonga committed 3 months ago
Unverified
f3d0080f2cb0c7b8305b558bf218928154cfad33

Add code of conduct

ssupermomonga committed 3 months ago
Unverified
7a3eb5c120e0363c9cdc02f9da9ee267d2847cbe

fix LICENSE

ssupermomonga committed 3 months ago

README

The README file for this repository.

Nonius

Nonius - screenshot

Lightweight Profiler Viewer for Rails Apps

Nonius is a desktop app that provides a streamlined interface for viewing and managing profiling results from your Rails applications. It integrates seamlessly with the Ruby profiling tool Vernier and presents profiling data using the powerful Firefox Profiler. If you're working with Rails apps and need an efficient way to visualize performance data, Nonius is here to make it simple and fast.

📦 Install

Pre-compiled binary

Build from source

You need to install .NET SDK.

dotnet publish src/Nonius/Nonius.csproj -c Release -r osx-arm64 -p:Platform=osx-arm64 -p:UseAppHost=true
sh src/bundle-macos.sh

Then, you can use dist/Nonius.app.

🔥 Key Features

  • Tailored for Rails: Nonius is designed specifically for Rails applications, making it easy to view profiling data with a UI optimized for common Rails patterns.
  • Multi-App Support: Manage and analyze profiling data from multiple Rails applications, all within the same interface.
  • Lightweight & Efficient: Nonius is designed to be fast and minimal, ensuring that you can quickly dive into performance insights without bloat or distractions.
  • Seamless Vernier Integration: Nonius automatically syncs with Vernier profiler to retrieve and display your profiling results.
  • Interactive Filtering: Easily sift through large profiling data with built-in filtering and search tools (coming soon).

🖥️ How It Works

  1. Profile Your Rails App: Integrate the Vernier profiler into your Rails app by adding the necessary code. This could be done either via:

    • Rack Middleware for monitoring general app performance, or
    • RSpec Request Specs for more targeted profiling.
  2. View Results in Nonius: Once profiling data is collected, simply open Nonius to see the results displayed using the Firefox Profiler interface. Nonius adds additional functionality like profiling data list views and filtering, making it easier to analyze your app's performance.

  3. Optimize Your App: Use the detailed profiling insights to identify performance bottlenecks and make your Rails app more efficient!

📚 Vernier Setup Guide

  1. Install Vernier in your Rails app:
# Gemfile
group :development, :test do
  gem 'vernier'
end
  1. Add Vernier profiling hooks, such as in a middleware or test suite:

for RSpec request spec:

# spec/support/vernier_profiler_support.rb
require 'vernier'
require 'securerandom'

module VernierProfilerSupport
  def get(path, **args) = with_vernier_profiling { super }
  def post(path, **args) = with_vernier_profiling { super }
  def delete(path, **args) = with_vernier_profiling { super }
  def put(path, **args) = with_vernier_profiling { super }
  def patch(path, **args) = with_vernier_profiling { super }
  def head(path, **args) = with_vernier_profiling { super }

  private def with_vernier_profiling
    Vernier.start_profile(
      out: Rails.root.join('tmp/profiling', "#{SecureRandom.uuid}.json").to_s,
      hooks: [:rails]
    )
    result = yield
    Vernier.stop_profile
    return result
  end
end
# spec/rails_helper.rb
if ENV.fetch('ENABLE_VERNIER_PROFILER', false)
  require_relative 'support/vernier_profiler_support'
  RSpec.configure do |config|
    config.include VernierProfilerSupport, type: :request
  end
end

for Rails server:

# lib/rack/vernier_profiler.rb
require 'vernier'
require 'securerandom'

class VernierProfiler
  def initialize(app)
    FileUtils.mkdir_p(Rails.root.join('tmp/profiling'))
    @app = app
  end

  def call(env)
    Vernier.start_profile(out: Rails.root.join('tmp/profiling', "#{SecureRandom.uuid}.json").to_s, hooks: [:rails])
    status, headers, response = @app.call(env)
    Vernier.stop_profile
    return [status, headers, response]
  end
end
# config/environments/development.rb
require "active_support/core_ext/integer/time"

Rails.application.configure do
  if ENV.fetch('ENABLE_VERNIER_PROFILER', false)
    require_relative '../../lib/rack/vernier_profiler'
    config.middleware.use VernierProfiler
  end
end
  1. Create a new project in Nonius, and configure profile data directory. In this case, your_rails_app_root_dir/tmp/profiling is the data directory.
  2. Start analyzing!

🚀 Roadmap

  • Offline Mode: Currently, Nonius relies on vernier's hosted profiler web interface ( https://vernier.prof/ ). An offline mode is planned to ensure full functionality without internet access.
  • Advanced Filtering: More powerful filtering and search capabilities, similar to Datadog, will soon be available for deep analysis of your profiling data.

🛠️ Contribution

We welcome contributions! If you find bugs or have feature suggestions, feel free to open an issue or submit a pull request.

📄 License

Nonius is open-source and available under the MIT License. See the LICENSE file for more information.


Happy profiling! 🎯