module InfluxReporter
Constants
- VERSION
Public Class Methods
Captures any exceptions raised inside the block
# File lib/influx_reporter.rb, line 137 def self.capture(&block) unless client return yield if block_given? return nil end client.capture(&block) end
# File lib/influx_reporter.rb, line 74 def self.flush_transactions client&.flush_transactions end
# File lib/influx_reporter.rb, line 78 def self.flush_transactions_if_needed client&.flush_transactions_if_needed end
Send an exception to InfluxReporter
@param exception [Exception] @param opts [Hash] @option opts [Hash] :rack_env A rack env object @return [Net::HTTPResponse]
# File lib/influx_reporter.rb, line 108 def self.report(exception, opts = {}) unless client return yield if block_given? return nil end client.report exception, opts end
Send an event to InfluxReporter
@param message [String] @param opts [Hash] @return [Net::HTTPResponse]
# File lib/influx_reporter.rb, line 131 def self.report_event(message, opts = {}) client&.report_event message, opts end
Send an exception to InfluxReporter
@param message [String] @param opts [Hash] @return [Net::HTTPResponse]
# File lib/influx_reporter.rb, line 122 def self.report_message(message, opts = {}) client&.report_message message, opts end
Sets context for future errors
@param context [Hash]
# File lib/influx_reporter.rb, line 85 def self.set_context(context) client&.set_context context end
Start the InfluxReporter
client
@param conf [Configuration] An Configuration
object
# File lib/influx_reporter.rb, line 29 def self.start!(conf) Client.start! conf end
# File lib/influx_reporter.rb, line 38 def self.started? !!Client.inst end
Stop the InfluxReporter
client
# File lib/influx_reporter.rb, line 34 def self.stop! Client.stop! end
Starts a new trace under the current Transaction
@param signature [String] A description of the trace, eq `SELECT FROM “users”` @param kind [String] The kind of trace, eq `db.mysql2.query` @param extra [Hash] Extra information about the trace @yield [Trace] Optional block encapsulating trace @return [Trace] Unless block given
# File lib/influx_reporter.rb, line 65 def self.trace(signature, kind = nil, extra = nil, &block) unless client return yield if block_given? return nil end client.trace signature, kind, extra, &block end
Start a new transaction or return the currently running
@param endpoint [String] A description of the transaction, eg `ExamplesController#index` @param kind [String] The kind of the transaction, eg `app.request.get` or `db.mysql2.query` @param result [Object] Result of the transaction, eq `200` for a HTTP server @yield [InfluxReporter::Transaction] Optional block encapsulating transaction @return [InfluxReporter::Transaction] Unless block given
# File lib/influx_reporter.rb, line 49 def self.transaction(endpoint, kind = nil, result = nil, &block) unless client return yield if block_given? return nil end client.transaction endpoint, kind, result, &block end
Updates context for errors within the block
@param context [Hash] @yield [Trace] Block in which the context is used
# File lib/influx_reporter.rb, line 93 def self.with_context(context, &block) unless client return yield if block_given? return nil end client.with_context context, &block end
Private Class Methods
# File lib/influx_reporter.rb, line 148 def self.client Client.inst end