Class: Graphite::Metric
Instance Attribute Summary collapse
-
#allow_children ⇒ Object
Returns the value of attribute allow_children.
-
#id ⇒ Object
Returns the value of attribute id.
-
#leaf ⇒ Object
Returns the value of attribute leaf.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Methods inherited from Base
authenticate, connection, get, set_connection
Instance Attribute Details
#allow_children ⇒ Object
Returns the value of attribute allow_children.
5 6 7 |
# File 'lib/graphite/metric.rb', line 5 def allow_children @allow_children end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/graphite/metric.rb', line 5 def id @id end |
#leaf ⇒ Object
Returns the value of attribute leaf.
5 6 7 |
# File 'lib/graphite/metric.rb', line 5 def leaf @leaf end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/graphite/metric.rb', line 5 def name @name end |
Class Method Details
.find_by_query(query) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/graphite/metric.rb', line 7 def self.find_by_query(query) return JSON.parse(self.get("/metrics/find",{:format => "treejson",:query => query}).body).map do |metric_hash| metric = Metric.new metric.name = metric_hash["text"] metric.id = metric_hash["id"] metric.allow_children = metric_hash["allowChildren"] == 1 metric.leaf = metric_hash["leaf"] == 1 metric end end |