Class: Metrix::Mongodb
Constant Summary
collapse
- DATABASE_RECORD_SET =
/^recordStats\.(.*?)\.(.*)/
- DATABASE_LOCK =
/^locks/
Instance Attribute Summary
Attributes inherited from Base
#attributes, #time
Instance Method Summary
collapse
Methods inherited from Json
#attributes, #extract
Methods inherited from Base
#cast_int, ignore, ignore_metrics, #initialize, #metrics, #tags, #unfiltered_metrics
Constructor Details
This class inherits a constructor from Metrix::Base
Instance Method Details
#ignore_metric?(metric) ⇒ Boolean
15
16
17
18
19
|
# File 'lib/metrix/mongodb.rb', line 15
def ignore_metric?(metric)
metric[DATABASE_RECORD_SET] ||
metric[DATABASE_LOCK] ||
super
end
|
#prefix ⇒ Object
8
9
10
|
# File 'lib/metrix/mongodb.rb', line 8
def prefix
"mongodb"
end
|
#tagged_metrics ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/metrix/mongodb.rb', line 21
def tagged_metrics
unfiltered_metrics.map do |k, v|
if k.match(DATABASE_RECORD_SET)
database = $1
Metric.new($2, "#{prefix}.locks.#{v}", time, database: database)
elsif k.match(DATABASE_LOCK)
chunks = k.split(".")
offset = 0
offset = 1 if chunks.at(1) == ""
database = chunks.at(1 + offset)
metric = chunks[(2 + offset)..-1].join(".")
database = "." if database == ""
Metric.new("#{prefix}.recordStats.#{metric}", v, time, database: database)
end
end.compact
end
|