Class: Honeycomb::Redis::Fields

Inherits:
Object
  • Object
show all
Defined in:
lib/honeycomb/integrations/redis.rb

Overview

This structure contains the fields we’ll add to each Redis span.

The logic is in this class to avoid monkey-patching extraneous APIs into the Redis::Client via Client.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Fields

Returns a new instance of Fields.



125
126
127
# File 'lib/honeycomb/integrations/redis.rb', line 125

def initialize(client)
  @client = client
end

Instance Method Details

#command=(commands) ⇒ Object



135
136
137
138
# File 'lib/honeycomb/integrations/redis.rb', line 135

def command=(commands)
  commands = Array(commands)
  values["redis.command"] = commands.map { |cmd| format(cmd) }.join("\n")
end

#options=(options) ⇒ Object



129
130
131
132
133
# File 'lib/honeycomb/integrations/redis.rb', line 129

def options=(options)
  options.each do |option, value|
    values["redis.#{option}"] ||= value unless ignore?(option)
  end
end

#to_hashObject



140
141
142
# File 'lib/honeycomb/integrations/redis.rb', line 140

def to_hash
  values
end