github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/ruby/rideshare/lib/server.rb (about)

     1  require "sinatra"
     2  require "thin"
     3  require "pyroscope"
     4  require_relative 'scooter/scooter'  
     5  require_relative 'bike/bike'
     6  require_relative 'car/car'
     7  
     8  
     9  Pyroscope.configure do |config|
    10    config.application_name = "ride-sharing-app"
    11    config.server_address = "http://pyroscope:4040"
    12    config.tags = {
    13      "region": ENV["REGION"],
    14    }
    15  end
    16  
    17  get "/bike" do
    18    order_bike(0.4)
    19    "<p>Bike ordered</p>"
    20  end
    21  
    22  get "/scooter" do
    23    order_scooter(0.6)
    24    "<p>Scooter ordered</p>"
    25  end
    26  
    27  get "/car" do
    28    order_car(0.8)
    29    "<p>Car ordered</p>"
    30  end
    31  
    32  
    33  set :bind, '0.0.0.0'
    34  set :port, 5000
    35  
    36  run Sinatra::Application.run!