Module: Takwimu
- Defined in:
- lib/takwimu/panel.rb,
lib/takwimu.rb,
lib/takwimu/rack.rb,
lib/takwimu/consts.rb,
lib/takwimu/railtie.rb,
lib/takwimu/version.rb,
lib/takwimu/periodic.rb,
lib/takwimu/reporter.rb,
lib/takwimu/configuration.rb,
lib/takwimu/resource_usage.rb,
lib/takwimu/instruments/ree_gc.rb,
lib/takwimu/notifications/base.rb,
lib/takwimu/request_statistics.rb,
lib/takwimu/instruments/ruby_gc.rb,
lib/takwimu/instruments/stopwatch.rb,
lib/takwimu/instruments/puma_backlog.rb,
lib/takwimu/instruments/gctools_oobgc.rb,
lib/takwimu/instruments/rails_request.rb,
lib/takwimu/instruments/passenger_stats.rb,
lib/takwimu/notifications/active_record.rb,
lib/takwimu/notifications/action_controller.rb,
lib/takwimu/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, Notifications Classes: Configuration, Panel, Periodic, Rack, Railtie, Reporter, RequestStatisitcs, ResourceUsage
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
- .configure {|config| ... } ⇒ Object
- .reset ⇒ Object
-
.start ⇒ Object
Starts the reporting client.
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
35 36 37 |
# File 'lib/takwimu.rb', line 35 def config @config end |
Class Method Details
.configure {|config| ... } ⇒ Object
46 47 48 |
# File 'lib/takwimu.rb', line 46 def self.configure yield(config) end |
.reset ⇒ Object
42 43 44 |
# File 'lib/takwimu.rb', line 42 def self.reset @config = Takwimu::Configuration.new end |
.start ⇒ 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.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/takwimu.rb', line 59 def self.start() #interval: Takwimu.config.interval, aggregation_period: Takwimu.config.aggregation_period, statsd: Takwimu.config.statsd, panels: Takwimu.config.panels, hostname: Takwimu.config.hostname) require 'statsd' statsd_client = Takwimu.config.statsd panels = Takwimu.config.panels sample_rate = Takwimu.config.interval.to_f / Takwimu.config.aggregation_period.to_f hostname = Takwimu.config.hostname if statsd_client == :default && ENV["PORT"] statsd_client = Statsd.new('127.0.0.1', ENV["PORT"]) end if statsd_client && statsd_client != :default reporter = Takwimu::Reporter.new(statsd: statsd_client, sample_rate: sample_rate, hostname: hostname) unless panels.length > 0 panels << Takwimu::ResourceUsage.new(sample_rate) end #Rails.logger.info "#{panels.inspect}" Periodic.new reporter: reporter, sample_rate: sample_rate, panels: panels end end |