Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

DeadBroHub

DeadBro's view of your app, inside the BroHub dashboard, next to EnvBro and SafeBro.

It reads from DeadBro with the API key the dead_bro gem already uses, so there is nothing new to configure except who may look.

Page Shows
Overview Requests, error rate, throughput and p95 per hour (24h), slowest endpoints, latest deploy
Endpoints Controller actions and jobs ranked by mean time, error rate, slow, N+1, CPU (1h / 24h / 7d / 30d)
Errors Distinct errors by last seen; detail with affected endpoints and recent occurrences
SQL queries Normalized statements ranked by total time, runs, p95, max; search by table or keyword
Findings What DeadBro keeps tracking, ranked by cost
Deploys Revisions and the errors since each
Status The gem in this process (on, sending, circuit breaker, dropped payloads) next to the settings DeadBro hands it

Rails 7.1+, Ruby 3.2+ (dead_bro itself still runs on 2.7+; this gem is the part that needs a newer Ruby). No database, no JavaScript.

Install

gem "dead_bro_hub"
bin/rails generate dead_bro_hub:install

This sets up BroHub if it isn't yet (mount point, the other Bro gems) and adds config/initializers/dead_bro_hub.rb. Then say who may look. Nobody can until you do: the pages show SQL, exception messages and request paths.

DeadBroHub.configure do |config|
  config.can_view = ->(user) { user&.admin? }
end

Visit /bro_hub/dead_bro_hub.

Configuration

DeadBroHub.configure do |config|
  config.can_view = ->(user) { ... }                                  # required, default denies everyone
  config.current_user = ->(controller) { controller.current_user }    # default: BroHub.config.current_user
  config.parent_controller = "::ApplicationController"
  config.cache_ttl = 30                                               # seconds in Rails.cache, 0 = off
  config.api_key = ENV["..."]                                         # default: DeadBro.configuration.api_key
  config.base_url = "https://www.deadbro.com"                         # default: what the dead_bro client sends to
end

How it works

Each page makes one request to its own endpoint, GET /api/v1/hub/<page> on DeadBro, with Authorization: Bearer <app api key>. The key resolves to exactly one application, so a leaked key reads that app's data and nothing else of the account. Successful responses are cached briefly in Rails.cache (the key is hashed into the cache key, never stored). If DeadBro is unreachable, slow or answers 5xx, the page renders a notice rather than failing.

Page Endpoint
Overview overview
Endpoints endpoints?window=&sort=
Errors errors?offset=&limit=, errors/:id
SQL queries queries?window=&sort=&search=&offset=&limit=
Findings findings?status=
Deploys deploys
Status settings (plus the gem's in-memory state, read locally)

SQL is returned normalized only; the sample statement with real values never leaves DeadBro.

Tests

bundle exec rake test

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages