Class: BuilderApm::RequestDataController

Inherits:
ApplicationController show all
Defined in:
app/controllers/builder_apm/request_data_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#redis_client

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
# File 'app/controllers/builder_apm/request_data_controller.rb', line 3

def index
    cursor = params[:cursor].presence&.to_f || Time.now.to_f * 1000
    limit = params[:limit].presence&.to_i || 50
    type = params[:type].presence || 'timestamps'

    purge_old_keys
    @requests = retrieve_data_from_redis_since(cursor, limit, type)
  Rails.logger.info "#{@requests.size} results gathered"
    render json: @requests
end