Sha256: a6f31a744e532bff2b29d3ce85c2ef3360e60e01c4f4d8e2d45ac8610d49e322

Contents?: true

Size: 452 Bytes

Versions: 7

Compression:

Stored size: 452 Bytes

Contents

module Switchman
  class ShardedInstrumenter < ::SimpleDelegator
    def initialize(instrumenter, shard_host)
      super instrumenter
      @shard_host = shard_host
    end

    def instrument(name, payload={})
      shard = @shard_host.try(:shard)
      if shard.is_a?(Shard)
        payload[:shard] = {
          id: shard.id,
          env: shard.database_server.shackles_environment
        }
      end
      super name, payload
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
switchman-1.2.4 lib/switchman/sharded_instrumenter.rb
switchman-1.2.3 lib/switchman/sharded_instrumenter.rb
switchman-1.2.2 lib/switchman/sharded_instrumenter.rb
switchman-1.2.1 lib/switchman/sharded_instrumenter.rb
switchman-1.2.0 lib/switchman/sharded_instrumenter.rb
switchman-1.1.0 lib/switchman/sharded_instrumenter.rb
switchman-1.0.0 lib/switchman/sharded_instrumenter.rb