Module: Barnes
- Defined in:
- lib/barnes.rb,
lib/barnes/panel.rb,
lib/barnes/consts.rb,
lib/barnes/railtie.rb,
lib/barnes/version.rb,
lib/barnes/periodic.rb,
lib/barnes/reporter.rb,
lib/barnes/resource_usage.rb,
lib/barnes/instruments/ree_gc.rb,
lib/barnes/instruments/ruby_gc.rb,
lib/barnes/instruments/stopwatch.rb,
lib/barnes/instruments/gctools_oobgc.rb,
lib/barnes/instruments/puma_instrument.rb,
lib/barnes/instruments/puma_stats_value.rb,
lib/barnes/instruments/object_space_counter.rb
Overview
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Defined Under Namespace
Modules: Instruments Classes: Panel, Periodic, Railtie, Reporter, ResourceUsage
Constant Summary collapse
- DEFAULT_INTERVAL =
10
- DEFAULT_AGGREGATION_PERIOD =
60
- DEFAULT_STATSD =
:default
- DEFAULT_PANELS =
[]
- VERSION =
"0.0.9"
Class Method Summary collapse
-
.start(interval: DEFAULT_INTERVAL, aggregation_period: DEFAULT_AGGREGATION_PERIOD, statsd: DEFAULT_STATSD, panels: DEFAULT_PANELS) ⇒ Object
Starts the reporting client.
Class Method Details
.start(interval: DEFAULT_INTERVAL, aggregation_period: DEFAULT_AGGREGATION_PERIOD, statsd: DEFAULT_STATSD, panels: DEFAULT_PANELS) ⇒ Object
Starts the reporting client
Arguments:
- interval: How often, in seconds, to instrument and report
- aggregation_period: The minimal aggregation period in use, in seconds.
- statsd: The statsd reporter. This should be an instance of statsd-ruby
- panels: The instrumentation "panels" in use. See `resource_usage.rb` for
an example panel, which is the default if none are provided.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/barnes.rb', line 40 def self.start(interval: DEFAULT_INTERVAL, aggregation_period: DEFAULT_AGGREGATION_PERIOD, statsd: DEFAULT_STATSD, panels: DEFAULT_PANELS) require 'statsd' statsd_client = statsd panels = panels sample_rate = interval.to_f / aggregation_period.to_f if statsd_client == :default && ENV["PORT"] statsd_client = Statsd.new('127.0.0.1', ENV["PORT"]) end if statsd_client && statsd_client != :default reporter = Barnes::Reporter.new(statsd: statsd_client, sample_rate: sample_rate) unless panels.length > 0 panels << Barnes::ResourceUsage.new(sample_rate) end Periodic.new( reporter: reporter, sample_rate: sample_rate, panels: panels, debug: ENV['BARNES_DEBUG'] ) end end |