-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add info collected from TiDB's server API #33
Conversation
@@ -28,7 +28,7 @@ def __init__(self, args, basedir=None, subdir=None): | |||
def get_label_names(self): | |||
result = [] | |||
url = '%s%s' % (self.url_base, '/label/__name__/values') | |||
labels = json.loads(util.read_url(url)) | |||
labels = json.loads(util.read_url(url)[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle when util.read_url(url)[0]
equals to None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't do that before the change, either. I'll do some more work on error handling later, there're more unhandled potential exceptions than this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And BTW, for this particular situation, the return won't be None
unless Prom is not working on this node, when trowing the exception will not getting things worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It's not available in any TiDB release yet, and v2.0.x does not support this API, so empty result will be generated for unsupported versions.
read_url()
to fit needs, more error handling of HTTP calls may be needed