Class: HeimdallApm::Reporting
- Inherits:
-
Object
- Object
- HeimdallApm::Reporting
- Defined in:
- lib/heimdall_apm/reporting.rb
Instance Method Summary collapse
- #call ⇒ Object
- #influx ⇒ Object
-
#initialize(context) ⇒ Reporting
constructor
A new instance of Reporting.
Constructor Details
#initialize(context) ⇒ Reporting
Returns a new instance of Reporting.
3 4 5 |
# File 'lib/heimdall_apm/reporting.rb', line 3 def initialize(context) @context = context end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/heimdall_apm/reporting.rb', line 11 def call span = @context.vault.retrieve_and_delete_previous_span if span && !span.points_collection.empty? influx.write_points(span.points_collection.to_a) else HeimdallApm.logger.debug "Nothing to report" end rescue => e HeimdallApm.logger.error "#{e.} during reporting to InfluxDB" end |
#influx ⇒ Object
7 8 9 |
# File 'lib/heimdall_apm/reporting.rb', line 7 def influx @client ||= InfluxDB::Client.new("#{Rails.env}_metrics", time_precision: 'ms', retry: 0) end |