示例#1
0
    def setUp(self):
        self.api = API()
        logging.basicConfig(level=logging.DEBUG)
        self.name = 'TEST_' + TestUtils.random_string(6)
        self.display_name = 'green'
        self.display_name_short = 'blue'
        self.description = 'magenta'
        self.default_aggregate = aggregates.SUM
        self.default_resolution = 60000
        self.unit = units.DURATION
        self.type = 'FOOBAR'
        self.is_disabled = False
        self.metric = Metric(name=self.name,
                             display_name=self.display_name,
                             display_name_short=self.display_name_short,
                             description=self.description,
                             default_aggregate=self.default_aggregate,
                             default_resolution=self.default_resolution,
                             unit=self.unit,
                             _type=self.type,
                             is_disabled=self.is_disabled)

        self.api.metric_create_batch([self.metric])

        logging.basicConfig(level=logging.INFO)
示例#2
0
 def __init__(self, path=None):
     super(ApacheLogfileParser, self).__init__(path)
     log_format = r'%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}\i"'
     self.parser = apachelog.parser(log_format)
     self.api = API()
     logging.basicConfig(level=logging.INFO)
示例#3
0
 def __init__(self, ):
     self.api = API()
     self.usage_args = ""
     # Set our application id from the environment variable
     self.app_id = os.environ['TSI_APP_ID']
示例#4
0
 def setUp(self):
     self.api = API()