Class: Flare::SetupCommand
- Inherits:
-
Object
- Object
- Flare::SetupCommand
- Includes:
- CLI::Output
- Defined in:
- lib/flare/cli/setup_command.rb
Constant Summary collapse
- DEFAULT_HOST =
"https://flare.am"- TIMEOUT_SECONDS =
5 minutes
300- INITIALIZER_CONTENT =
<<~RUBY # frozen_string_literal: true Flare.configure do |config| # ── Spans (local development dashboard) ──────────────────────────── # Spans capture detailed trace data and are stored in a local SQLite # database. Enabled by default in development only. Visit /flare in # your browser to see the dashboard. # Enable or disable spans (default: true in development) # config.spans_enabled = true # How long to keep spans in hours (default: 24) # config.retention_hours = 24 # Maximum number of spans to store (default: 10000) # config.max_spans = 10000 # Path to the SQLite database (default: db/flare.sqlite3) # config.database_path = Rails.root.join("db", "flare.sqlite3").to_s # Ignore specific requests (receives a Rack::Request, return true to ignore) # config.ignore_request = ->(request) { # request.path.start_with?("/health") # } # ── Metrics (remote monitoring) ──────────────────────────────────── # Metrics aggregate span data into counts, durations, and error rates. # Enabled by default in development and production (disabled in test). # Sent to flare.am when FLARE_KEY is configured. # Enable or disable metrics (default: true except in test) # config.metrics_enabled = true # How often to flush metrics in seconds (default: 60) # config.metrics_flush_interval = 60 # ── Custom Instrumentation ───────────────────────────────────────── # Subscribe to additional notification prefixes (default: ["app."]) # config.subscribe_patterns << "mycompany." end # ════════════════════════════════════════════════════════════════════════ # Custom Instrumentation # ════════════════════════════════════════════════════════════════════════ # # Use ActiveSupport::Notifications.instrument with an "app." prefix # anywhere in your code. Flare captures these in development and # displays them in the dashboard. # # ActiveSupport::Notifications.instrument("app.geocoding", address: address) do # geocoder.lookup(address) # end # # ActiveSupport::Notifications.instrument("app.stripe.charge", amount: 1000) do # Stripe::Charge.create(amount: 1000, currency: "usd") # end RUBY
Instance Method Summary collapse
-
#initialize(force: false) ⇒ SetupCommand
constructor
A new instance of SetupCommand.
- #run ⇒ Object
Constructor Details
#initialize(force: false) ⇒ SetupCommand
Returns a new instance of SetupCommand.
79 80 81 |
# File 'lib/flare/cli/setup_command.rb', line 79 def initialize(force: false) @force = force end |
Instance Method Details
#run ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/flare/cli/setup_command.rb', line 83 def run authenticate create_initializer add_gitignore_entries puts puts "#{green("Setup complete!")}" puts puts bold("What's next:") puts " 1. Start your Rails server (#{dim("bin/rails server")})" puts " 2. Make a few requests to your app" puts " 3. Visit #{bold("/flare")} to see the dashboard" puts puts dim(" The dashboard auto-mounts at /flare in development.") puts dim(" Metrics are sent to flare.am when FLARE_KEY is configured.") puts puts " Run #{bold("flare doctor")} to verify your setup." puts " Run #{bold("flare status")} to see your configuration." rescue Interrupt puts puts "Setup cancelled." exit 1 end |