Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MB-6906: Skip stats if it is not retrieved from ns_server

Not all stats exist on all different releases. Such as
'replication_changes_left', 'xdc_ops'. Simply ignore them.
  • Loading branch information...
commit c57c6305858d18d8c9d863f3f9ec0b5b0661b25d 1 parent 20873d5
@bcui6611 bcui6611 authored
Showing with 6 additions and 9 deletions.
  1. +2 −0  cluster_stats.py
  2. +1 −0  collector.py
  3. +3 −9 restclient.py
View
2  cluster_stats.py
@@ -607,6 +607,8 @@ def run(self, accessor, scale, threshold=None):
if stats_info[scale].has_key(accessor["counter"]) == False:
continue
values = stats_info[scale][accessor["counter"]]
+ if values is None:
+ continue
timestamps = values["timestamp"]
timestamps = [x - timestamps[0] for x in timestamps]
nodeStats = values["nodeStats"]
View
1  collector.py
@@ -266,6 +266,7 @@ def get_ns_stats(self, bucketlist, server, port, user, password, bucketname, sca
stats_buffer.buckets[bucket_name][scale][stat] = json
except Exception, err:
self.log.debug("%s doesn't exist from ns stats" % stat)
+ stats_buffer.buckets[bucket_name][scale][stat] = None
pass
sys.stderr.write('\n')
View
12 restclient.py
@@ -64,16 +64,10 @@ def handleResponse(self,
if response.status == 401:
print 'ERROR: unable to access the REST API - please check your username (-u) and password (-p)'
sys.exit(2)
- print 'ERROR: %s (%d) %s' % (opts['error_msg'],
- response.status, response.reason)
+ #print 'ERROR: %s (%d) %s' % (opts['error_msg'],
+ # response.status, response.reason)
- output_json = json.loads(response.read())
- print output_json
- if "errors" in output_json:
- for error_code,error_message in output_json["errors"].iteritems():
- print "ERROR: %s" % error_message
-
- sys.exit(2)
+ raise ValueEerror()
def bootStrap(self, headers):
""" First REST call needed for info for later REST calls.
Please sign in to comment.
Something went wrong with that request. Please try again.