Module: Perfgate::Instrumentation

Defined in:
lib/perfgate/instrumentation.rb,
lib/perfgate/instrumentation/gc.rb,
lib/perfgate/instrumentation/duration.rb,
lib/perfgate/instrumentation/allocations.rb,
lib/perfgate/instrumentation/sql_activity.rb

Overview

Instrumentation collectors for the metrics a workload can measure (spec section 13): each collector module exposes .start/.finish and is invoked only within a workload's explicit Perfgate.measure block.

Defined Under Namespace

Modules: Allocations, Duration, Gc, SqlActivity

Constant Summary collapse

REGISTRY =

Maps a workload's configured metric names (spec section 11's metrics config, e.g. :duration, :sql_count) to the collector module responsible for it. sql_count and sql_duration share a single collector since both come from the same notification subscription. memory (section 13.6) is intentionally absent: it is disabled by default and not yet implemented.

{
  duration: Duration,
  sql_count: SqlActivity,
  sql_duration: SqlActivity,
  allocations: Allocations,
  gc: Gc
}.freeze

Class Method Summary collapse

Class Method Details

.collectors_for(metric_names) ⇒ Object

The distinct set of collectors needed to satisfy the given metric names, in a stable order.



32
33
34
# File 'lib/perfgate/instrumentation.rb', line 32

def collectors_for(metric_names)
  metric_names.filter_map { |name| REGISTRY[name] }.uniq
end