module Yabeda::Gruf

Constants

LONG_RUNNING_REQUEST_BUCKETS
REQUEST_LABELS
VERSION

Attributes

gruf_server[RW]

Public Class Methods

install!() click to toggle source
# File lib/yabeda/gruf.rb, line 22
def install!
  configure_yabeda!
end

Private Class Methods

configure_yabeda!() click to toggle source
# File lib/yabeda/gruf.rb, line 28
def configure_yabeda!
  Yabeda.configure do
    group :gruf do
      # server interceptor
      counter   :served_requests_total,
                comment: 'A counter of the total number of gRPC requests processed.',
                tags: REQUEST_LABELS
      histogram :served_request_duration, unit: :seconds, buckets: LONG_RUNNING_REQUEST_BUCKETS,
                                          comment: 'A histogram of the response latency.',
                                          tags: REQUEST_LABELS

      # server collector
      gauge :pool_jobs_waiting_total, comment: 'Number of jobs in thread pool waiting'
      gauge :pool_ready_workers_total, comment: 'Number of non-busy workers in thread pool'
      gauge :pool_workers_total, comment: 'Total number of workers in thread pool'
      gauge :pool_initial_size, comment: 'Initial size of thread pool'
      gauge :poll_period, comment: 'Polling period for thread pool'
    end

    collect do
      Yabeda::Gruf::StatsCollector.new.collect! if Yabeda::Gruf.gruf_server
    end
  end
end