Example #1
0
 def setUp(self):
     super(PrometheusCollectorTest, self).setUp()
     self._tenant_id = samples.TENANT
     args = {
         'period': 3600,
         'scope_key': 'namespace',
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'groupby': [
                         'foo',
                         'bar',
                     ],
                     'metadata': [
                         'code',
                         'instance',
                     ],
                     'extra_args': {
                         'aggregation_method': 'avg',
                     },
                 },
             }
         }
     }
     self.collector = prometheus.PrometheusCollector(**args)
Example #2
0
 def setUp(self):
     super(PrometheusCollectorTest, self).setUp()
     self._tenant_id = samples.TENANT
     args = {
         'period': 3600,
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'extra_args': {
                         'query': 'http_request_total[$period]',
                     },
                 },
             }
         }
     }
     transformers = transformer.get_transformers()
     self.collector = prometheus.PrometheusCollector(transformers, **args)
Example #3
0
 def setUp(self):
     super(PrometheusCollectorTest, self).setUp()
     self._tenant_id = samples.TENANT
     args = {
         'period': 3600,
         'scope_key': 'namespace',
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'groupby': [
                         'foo',
                         'bar',
                     ],
                     'metadata': [
                         'code',
                         'instance',
                     ],
                     'extra_args': {
                         'aggregation_method': 'avg'
                     },
                 },
             }
         }
     }
     args_range_function = {
         'period': 3600,
         'scope_key': 'namespace',
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'groupby': [
                         'foo',
                         'bar',
                     ],
                     'metadata': [
                         'code',
                         'instance',
                     ],
                     'extra_args': {
                         'aggregation_method': 'avg',
                         'query_function': 'abs',
                     },
                 },
             }
         }
     }
     args_query_function = {
         'period': 3600,
         'scope_key': 'namespace',
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'groupby': [
                         'foo',
                         'bar',
                     ],
                     'metadata': [
                         'code',
                         'instance',
                     ],
                     'extra_args': {
                         'aggregation_method': 'avg',
                         'range_function': 'delta',
                     },
                 },
             }
         }
     }
     args_all = {
         'period': 3600,
         'scope_key': 'namespace',
         'conf': {
             'metrics': {
                 'http_requests_total': {
                     'unit': 'instance',
                     'groupby': [
                         'foo',
                         'bar',
                     ],
                     'metadata': [
                         'code',
                         'instance',
                     ],
                     'extra_args': {
                         'aggregation_method': 'avg',
                         'range_function': 'delta',
                         'query_function': 'abs',
                     },
                 },
             }
         }
     }
     self.collector_mandatory = prometheus.PrometheusCollector(**args)
     self.collector_without_range_function = prometheus.PrometheusCollector(
         **args_range_function)
     self.collector_without_query_function = prometheus.PrometheusCollector(
         **args_query_function)
     self.collector_all = prometheus.PrometheusCollector(**args_all)