Skip to content

Commit

Permalink
Improvements (#57)
Browse files Browse the repository at this point in the history
* TOOLS-1240: (TOOLS) Support for XDR Publication framework.

* TOOLS-1242: (TOOLS) Fix to support logs with milliseconds.
  • Loading branch information
hbpatre authored Nov 14, 2018
1 parent 5bbeffa commit 5d659e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/log/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LogReader(object):
server_log_ext = "/aerospike.log"
server_log_file_identifier = [
"thr_info.c::", "heartbeat_received", "Cluster_size"]
server_log_file_identifier_pattern = "(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{2} \d{4} \d{2}:\d{2}:\d{2} GMT([-+]\d+){0,1}: (?:INFO|WARNING|DEBUG|DETAIL) \([a-z_:]+\): \([A-Za-z_\.\[\]]+:{1,2}-?[\d]+\)"
server_log_file_identifier_pattern = "(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{2} \d{4} \d{2}:\d{2}:\d{2}(\.\d+){0,3} GMT([-+]\d+){0,1}: (?:INFO|WARNING|DEBUG|DETAIL) \([a-z_:]+\): \([A-Za-z_\.\[\]]+:{1,2}-?[\d]+\)"
logger = logging.getLogger('asadm')

def get_server_node_id(self, file, fetch_end="tail",
Expand Down Expand Up @@ -186,6 +186,8 @@ def _get_dt(self, line):

def parse_dt(self, line, dt_len=6):
prefix = line[0: line.find(" GMT")].split(",")[0]
# remove milliseconds if available
prefix = prefix.split(".")[0]
return datetime.datetime(*(time.strptime(prefix, DT_FMT)[0:dt_len]))

def _seek_to(self, f, c):
Expand Down
6 changes: 4 additions & 2 deletions lib/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,9 @@ def info_dc(stats, cluster, timestamp="", **ignore):

title_suffix = CliView._get_timestamp_suffix(timestamp)
title = "DC Information%s" % (title_suffix)
column_names = ('node', ('_dc-name', 'DC'), ('_xdr_dc_size', 'DC size'), 'namespaces', ('_lag-secs', 'Lag (sec)'), ('_xdr_dc_remote_ship_ok', 'Records Shipped'), ('_latency_avg_ship_ema', 'Avg Latency (ms)'), ('_xdr-dc-state', 'Status')
column_names = ('node', ('_dc-name', 'DC'), ('dc-type', 'DC type'), ('_xdr_dc_size', 'DC size'),
'namespaces',('_lag-secs', 'Lag (sec)'), ('_xdr_dc_remote_ship_ok', 'Records Shipped'),
('_latency_avg_ship_ema', 'Avg Latency (ms)'), ('_xdr-dc-state', 'Status')
)

t = Table(title, column_names, group_by=1)
Expand All @@ -738,7 +740,7 @@ def info_dc(stats, cluster, timestamp="", **ignore):
'_dc-name', lambda data: get_value_from_dict(data, ('dc-name', 'DC_Name')))

t.add_data_source('_xdr_dc_size', lambda data: get_value_from_dict(
data, ('xdr_dc_size', 'dc_size')))
data, ('xdr_dc_size', 'dc_size', 'dc_as_size', 'dc_http_good_locations')))

t.add_data_source(
'_lag-secs', Extractors.time_extractor(('xdr-dc-timelag', 'xdr_dc_timelag', 'dc_timelag')))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
setup (
version = "0.1.22",
version = "0.1.23",
name = "asadm",
packages=find_packages(exclude=['doc', 'test*']),
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.22
0.1.23

0 comments on commit 5d659e0

Please sign in to comment.