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

Hbase metric lost due to coding problems In python2 #439

Merged
merged 6 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions collectors/lib/hadoop_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ def poll(self):

def emit_metric(self, context, current_time, metric_name, value, tag_dict=None):
if not tag_dict:
print("%s.%s.%s.%s %d %d" % (self.service, self.daemon, ".".join(context), metric_name, current_time, value))
print("%s.%s.%s.%s %d %d" % (self.service, self.daemon, ".".join(context), metric_name, current_time, float(value)))
else:
tag_string = " ".join([k + "=" + v for k, v in tag_dict.iteritems()])
print ("%s.%s.%s.%s %d %d %s" % \
(self.service, self.daemon, ".".join(context), metric_name, current_time, value, tag_string))
(self.service, self.daemon, ".".join(context), metric_name, current_time, float(value), tag_string))
# flush to protect against subclassed collectors that output few metrics not having enough output to trigger
# buffer flush within 10 mins, which then get killed by TCollector due to "inactivity"
sys.stdout.flush()
Expand Down
7 changes: 6 additions & 1 deletion collectors/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ def is_numeric(value):
return isinstance(value, (int, float))
else:
def is_numeric(value):
return isinstance(value, (int, long, float)) # pylint: disable=undefined-variable
try:
float(str(value))
return True
except ValueError:
pass
return False