Skip to content
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

Merged
merged 4 commits into from
Aug 21, 2018

Conversation

AstroProfundis
Copy link
Contributor

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.

  • Adjusted read_url() to fit needs, more error handling of HTTP calls may be needed

@@ -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])
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, LGTM

Copy link
Contributor

@ethercflow ethercflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ethercflow ethercflow merged commit f1ee159 into pingcap:master Aug 21, 2018
@AstroProfundis AstroProfundis deleted the tidb-api branch August 21, 2018 07:00
@AstroProfundis AstroProfundis added the enhancement New feature or request label Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants