lib/appsignal.rb in appsignal-1.2.5 vs lib/appsignal.rb in appsignal-1.3.0.beta.1
- old
+ new
@@ -56,11 +56,15 @@
Appsignal::Extension.start
Appsignal::Hooks.load_hooks
Appsignal::EventFormatter.initialize_formatters
initialize_extensions
Appsignal::Extension.install_allocation_event_hook if config[:enable_allocation_tracking]
- Appsignal::Extension.install_gc_event_hooks if config[:enable_gc_instrumentation]
+ if config[:enable_gc_instrumentation]
+ Appsignal::Extension.install_gc_event_hooks
+ Appsignal::Minutely.add_gc_probe
+ end
+ Appsignal::Minutely.start if config[:enable_minutely_probes]
@subscriber = Appsignal::Subscriber.new
else
logger.info("Not starting, not active for #{config.env}")
end
else
@@ -175,36 +179,43 @@
return false unless transaction
transaction.set_tags(params)
end
alias :tag_job :tag_request
+ def instrument(name, title=nil, body=nil, body_format=Appsignal::EventFormatter::DEFAULT)
+ Appsignal::Transaction.current.start_event
+ r = yield
+ Appsignal::Transaction.current.finish_event(name, title, body, body_format)
+ r
+ end
+
def set_gauge(key, value)
- Appsignal::Extension.set_gauge(key, value.to_f)
+ Appsignal::Extension.set_gauge(key.to_s, value.to_f)
rescue RangeError
Appsignal.logger.warn("Gauge value #{value} for key '#{key}' is too big")
end
def set_host_gauge(key, value)
- Appsignal::Extension.set_host_gauge(key, value.to_f)
+ Appsignal::Extension.set_host_gauge(key.to_s, value.to_f)
rescue RangeError
Appsignal.logger.warn("Host gauge value #{value} for key '#{key}' is too big")
end
def set_process_gauge(key, value)
- Appsignal::Extension.set_process_gauge(key, value.to_f)
+ Appsignal::Extension.set_process_gauge(key.to_s, value.to_f)
rescue RangeError
Appsignal.logger.warn("Process gauge value #{value} for key '#{key}' is too big")
end
def increment_counter(key, value=1)
- Appsignal::Extension.increment_counter(key, value)
+ Appsignal::Extension.increment_counter(key.to_s, value)
rescue RangeError
Appsignal.logger.warn("Counter value #{value} for key '#{key}' is too big")
end
def add_distribution_value(key, value)
- Appsignal::Extension.add_distribution_value(key, value.to_f)
+ Appsignal::Extension.add_distribution_value(key.to_s, value.to_f)
rescue RangeError
Appsignal.logger.warn("Distribution value #{value} for key '#{key}' is too big")
end
def logger
@@ -278,9 +289,10 @@
require 'appsignal/auth_check'
require 'appsignal/config'
require 'appsignal/event_formatter'
require 'appsignal/hooks'
require 'appsignal/marker'
+require 'appsignal/minutely'
require 'appsignal/params_sanitizer'
require 'appsignal/integrations/railtie' if defined?(::Rails)
require 'appsignal/integrations/resque'
require 'appsignal/integrations/resque_active_job'
require 'appsignal/subscriber'