Class: TCellAgent::Instrumentation::ContextFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/tcell_agent/instrumentation.rb

Constant Summary collapse

DATABASE =
'db'.freeze
REQUEST =
'request'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context.



14
15
16
# File 'lib/tcell_agent/instrumentation.rb', line 14

def context
  @context
end

#databaseObject

Returns the value of attribute database.



16
17
18
# File 'lib/tcell_agent/instrumentation.rb', line 16

def database
  @database
end

#fieldObject

Returns the value of attribute field.



19
20
21
# File 'lib/tcell_agent/instrumentation.rb', line 19

def field
  @field
end

#parameterObject

Returns the value of attribute parameter.



15
16
17
# File 'lib/tcell_agent/instrumentation.rb', line 15

def parameter
  @parameter
end

#ruleObject

Returns the value of attribute rule.



13
14
15
# File 'lib/tcell_agent/instrumentation.rb', line 13

def rule
  @rule
end

#schemaObject

Returns the value of attribute schema.



17
18
19
# File 'lib/tcell_agent/instrumentation.rb', line 17

def schema
  @schema
end

#tableObject

Returns the value of attribute table.



18
19
20
# File 'lib/tcell_agent/instrumentation.rb', line 18

def table
  @table
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/tcell_agent/instrumentation.rb', line 12

def type
  @type
end

Instance Method Details

#create_hash_valueObject



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

def create_hash_value
  "#{type}#{context}#{parameter}#{database}#{schema}#{table}#{field}#{rule}".hash
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/tcell_agent/instrumentation.rb', line 36

def eql?(other)
  hash == other.hash
end

#for_database(database, schema, table, field, rule) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/tcell_agent/instrumentation.rb', line 44

def for_database(database, schema, table, field, rule)
  self.type = ContextFilter::DATABASE
  self.database = database
  self.schema = schema
  self.table = table
  self.field = field
  self.rule = rule
  self
end

#for_request(context, parameter, rule) ⇒ Object

rubocop:disable Lint/DuplicateMethods



54
55
56
57
58
59
60
# File 'lib/tcell_agent/instrumentation.rb', line 54

def for_request(context, parameter, rule)
  self.type = ContextFilter::REQUEST
  self.context = context
  self.parameter = parameter
  self.rule = rule
  self
end

#hashObject



40
41
42
# File 'lib/tcell_agent/instrumentation.rb', line 40

def hash
  create_hash_value
end