def get(self, name, **query_props): resp = self._mexe("metrics/%s" % name, method="GET", query_props=query_props) if resp["type"] == "gauge": return Gauge.from_dict(self, resp) elif resp["type"] == "counter": return Gauge.from_dict(self, resp) else: raise Exception("The server sent me something that is not a Gauge nor a Counter.")
def get(self, name, **query_props): resp = self._mexe("metrics/%s" % name, method="GET", query_props=query_props) if resp['type'] == 'gauge': return Gauge.from_dict(self, resp) elif resp['type'] == 'counter': return Gauge.from_dict(self, resp) else: raise Exception( 'The server sent me something that is not a Gauge nor a Counter.' )
def get(self, name, **query_props): resp = self._mexe("metrics/%s" % self.sanitize(name), method="GET", query_props=query_props) if resp['type'] == 'gauge': return Gauge.from_dict(self, resp) elif resp['type'] == 'counter': return Counter.from_dict(self, resp) else: raise Exception('The server sent me something that is not a Gauge nor a Counter.')
def create_gauge(self, name, description=None, **query_props): """Create a new gauge""" from librato.metrics import Gauge if query_props is None: query_props = {} query_props['name'] = name if description: query_props['description'] = description resp = self._mexe("gauges.json", method="POST", query_props=query_props) return Gauge.from_dict(self, resp)
def get_gauge(self, name): """Fetch a specific gauge""" from librato.metrics import Gauge resp = self._mexe("gauges/%s.json" % name) return Gauge.from_dict(self, resp)