コード例 #1
0
 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.")
コード例 #2
0
 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.'
         )
コード例 #3
0
ファイル: __init__.py プロジェクト: pcn/python-librato
 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.')
コード例 #4
0
ファイル: connection.py プロジェクト: fictivekin/librato
	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)
コード例 #5
0
ファイル: connection.py プロジェクト: fictivekin/librato
	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)