Skip to content

Commit

Permalink
KV metrics now include 'for' label
Browse files Browse the repository at this point in the history
Change-Id: I9110ae0407ddc7ee1bf2c99c6485b978d0a02d8c
Reviewed-on: https://review.couchbase.org/c/testrunner/+/180967
Tested-by: Ritesh Agarwal <ritesh.agarwal@couchbase.com>
Reviewed-by: Ritesh Agarwal <ritesh.agarwal@couchbase.com>
  • Loading branch information
pierrecouch authored and ritalrw committed Oct 7, 2022
1 parent 546e0a1 commit d37d759
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/metering_throttling.py
Expand Up @@ -11,7 +11,8 @@ def __init__(self, server, username, password):
self.nodes = response.json()['nodes']
self.log = logger.Logger.get_logger()

def meter_pattern(self, unit, bucket, service, unbilled='', variant=''):
@staticmethod
def __meter_pattern(unit, bucket, service, unbilled='', variant=''):
meter_service = ''
meter_unbilled = ''
meter_variant = ''
Expand All @@ -26,7 +27,7 @@ def meter_pattern(self, unit, bucket, service, unbilled='', variant=''):

def get_query_cu(self, bucket='default', unbilled='true', variant='eval'):
cu = 0
qry_cu_pattern = re.compile(self.meter_pattern('cu', bucket, 'n1ql', unbilled, variant))
qry_cu_pattern = re.compile(metering.__meter_pattern('cu', bucket, 'n1ql', unbilled, variant))
for node in self.nodes:
if 'n1ql' in node['services']:
url = f"https://{node['hostname'][:-5]}:{CbServer.ssl_port}/metrics"
Expand All @@ -38,8 +39,8 @@ def get_query_cu(self, bucket='default', unbilled='true', variant='eval'):

def get_index_rwu(self, bucket='default', unbilled = '', variant = ''):
ru, wu = 0, 0
idx_ru_pattern = re.compile(self.meter_pattern('ru', bucket, 'index', unbilled, variant))
idx_wu_pattern = re.compile(self.meter_pattern('wu', bucket, 'index', unbilled, variant))
idx_ru_pattern = re.compile(metering.__meter_pattern('ru', bucket, 'index', unbilled, variant))
idx_wu_pattern = re.compile(metering.__meter_pattern('wu', bucket, 'index', unbilled, variant))
for node in self.nodes:
if 'index' in node['services']:
url = f"https://{node['hostname'][:-5]}:{CbServer.ssl_port}/metrics"
Expand All @@ -53,8 +54,8 @@ def get_index_rwu(self, bucket='default', unbilled = '', variant = ''):

def get_fts_rwu(self, bucket='default', unbilled = '', variant = ''):
ru, wu = 0, 0
fts_ru_pattern = re.compile(self.meter_pattern('ru', bucket, 'fts', unbilled, variant))
fts_wu_pattern = re.compile(self.meter_pattern('wu', bucket, 'fts', unbilled, variant))
fts_ru_pattern = re.compile(metering.__meter_pattern('ru', bucket, 'fts', unbilled, variant))
fts_wu_pattern = re.compile(metering.__meter_pattern('wu', bucket, 'fts', unbilled, variant))
for node in self.nodes:
if 'fts' in node['services']:
url = f"https://{node['hostname'][:-5]}:{CbServer.ssl_port}/metrics"
Expand All @@ -68,8 +69,8 @@ def get_fts_rwu(self, bucket='default', unbilled = '', variant = ''):

def get_kv_rwu(self, bucket='default', unbilled ='', variant =''):
ru, wu = 0, 0
kv_ru_pattern = re.compile(self.meter_pattern('ru', bucket, '', unbilled, variant))
kv_wu_pattern = re.compile(self.meter_pattern('wu', bucket, '', unbilled, variant))
kv_ru_pattern = re.compile(metering.__meter_pattern('ru', bucket, 'kv', unbilled, variant))
kv_wu_pattern = re.compile(metering.__meter_pattern('wu', bucket, 'kv', unbilled, variant))
for node in self.nodes:
if 'kv' in node['services']:
url = f"https://{node['hostname'][:-5]}:{CbServer.ssl_port}/metrics"
Expand Down

0 comments on commit d37d759

Please sign in to comment.