Class: Sequel::SchemaSharding::DTraceProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/schema-sharding/dtrace_provider.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDTraceProvider

Returns a new instance of DTraceProvider.



8
9
10
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 8

def initialize
  @provider = USDT::Provider.create(:ruby, :sequel_schema_sharding)
end

Instance Attribute Details

#providerObject (readonly)

Returns the value of attribute provider.



6
7
8
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 6

def provider
  @provider
end

Class Method Details

.providerObject



24
25
26
27
28
29
30
31
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 24

def self.provider
  @provider ||= new.tap do |p|
    p.read_only_shard_for
    p.replica_hash_for
    p.shard_for
    p.provider.enable
  end
end

Instance Method Details

#read_only_shard_forObject



12
13
14
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 12

def read_only_shard_for
  @read_only_probe ||= provider.probe(:model, :read_only_shard_for, :string, :integer, :string)
end

#replica_hash_forObject



16
17
18
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 16

def replica_hash_for
  @replica_hash_for ||= provider.probe(:connection_manager, :replica_hash_for, :string)
end

#shard_forObject



20
21
22
# File 'lib/sequel/schema-sharding/dtrace_provider.rb', line 20

def shard_for
  @shard_for_probe ||= provider.probe(:model, :shard_for, :string, :integer, :string)
end