A tool for measuring the coverage of Bluesky/ATProto relays
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

save report records to db on finish

+56
+13
db/migrate/20260302043512_create_reports.rb
··· 1 + class CreateReports < ActiveRecord::Migration[7.0] 2 + def change 3 + create_table :reports do |t| 4 + t.datetime :start_time, precision: 0, null: false 5 + t.string :host, null: false 6 + t.integer :duration, null: false 7 + t.integer :users, null: false 8 + t.integer :events, null: false 9 + end 10 + 11 + add_index :reports, :start_time 12 + end 13 + end
+22
db/schema.rb
··· 1 + # This file is auto-generated from the current state of the database. Instead 2 + # of editing this file, please use the migrations feature of Active Record to 3 + # incrementally modify your database, and then regenerate this schema definition. 4 + # 5 + # This file is the source Rails uses to define your schema when running `bin/rails 6 + # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 + # be faster and is potentially less error prone than running all of your 8 + # migrations from scratch. Old migrations may fail to apply correctly if those 9 + # migrations use external dependencies or application code. 10 + # 11 + # It's strongly recommended that you check this file into your version control system. 12 + 13 + ActiveRecord::Schema[7.2].define(version: 2026_03_02_043512) do 14 + create_table "reports", force: :cascade do |t| 15 + t.datetime "start_time", precision: 0, null: false 16 + t.string "host", null: false 17 + t.integer "duration", null: false 18 + t.integer "users", null: false 19 + t.integer "events", null: false 20 + t.index ["start_time"], name: "index_reports_on_start_time" 21 + end 22 + end
+3
report.rb
··· 1 + class Report < ActiveRecord::Base 2 + validates_presence_of :start_time, :host, :duration, :users, :events 3 + end
+18
run_test.rb
··· 1 1 #!/usr/bin/env ruby 2 2 3 3 require 'bundler/setup' 4 + 5 + require 'json' 6 + require 'sinatra/activerecord' 4 7 require 'skyfall' 5 8 require 'yaml' 6 9 7 10 require_relative 'opts' 11 + require_relative 'report' 12 + 13 + ActiveRecord::Base.logger = nil 8 14 9 15 SOURCES = 'config/sources.yml' 10 16 ··· 23 29 24 30 verbose = options[:verbose] 25 31 duration = options[:duration] || config['duration']&.to_i || 60 * 15 32 + test_start_time = Time.now 26 33 27 34 Worker = Struct.new(:host, :pid, :pipe) 28 35 workers = [] ··· 81 88 workers.delete(worker) 82 89 83 90 line = worker.pipe.gets 91 + next if line.nil? 84 92 puts "#{worker.host}: #{line}" if verbose 93 + 94 + events, users = JSON.parse(line) 95 + 96 + Report.create!( 97 + start_time: test_start_time, 98 + duration: duration, 99 + host: worker.host, 100 + users: users, 101 + events: events 102 + ) 85 103 end 86 104 rescue Interrupt 87 105 puts