Sha256: 0709dd28f963193f34bfa244698f1093d434839b29f4f113c858173d3f0dfa86
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require "influxdb/rails/middleware/subscriber" module InfluxDB module Rails module Middleware class RequestSubscriber < Subscriber # :nodoc: def write super ensure InfluxDB::Rails.current.reset end private def tags { method: "#{payload[:controller]}##{payload[:action]}", hook: "process_action", status: status, format: payload[:format], http_method: payload[:method], exception: payload[:exception]&.first, } end def values { controller: duration, view: (payload[:view_runtime] || 0).ceil, db: (payload[:db_runtime] || 0).ceil, started: started, } end def started InfluxDB.convert_timestamp( start.utc, configuration.client.time_precision ) end def status if payload[:exception] && ::Rails::VERSION::MAJOR < 7 ActionDispatch::ExceptionWrapper.status_code_for_exception(payload[:exception].first) else payload[:status] end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
influxdb-rails-1.0.3 | lib/influxdb/rails/middleware/request_subscriber.rb |