summaryrefslogtreecommitdiff
path: root/osprofiler/cmd
diff options
context:
space:
mode:
authorTovin Seven <vinhnt@vn.fujitsu.com>2017-12-22 17:23:55 +0700
committerTovin Seven <vinhnt@vn.fujitsu.com>2018-02-05 15:14:17 +0700
commit113a2dddddf6a67d0a2b69d94eef325e39520ac8 (patch)
tree984e90c49f73fb064157a8db705814c65e7313b1 /osprofiler/cmd
parent41ad0ea221d6afd82aa264a9e18ca8aafbf845d3 (diff)
downloadosprofiler-113a2dddddf6a67d0a2b69d94eef325e39520ac8.tar.gz
Filter traces that contain error/exception2.0.0
Adds ability to filter error traces to OSProfiler. Adds command for list error traces. Change-Id: I0ec97337cae5e573fedae2b6665aa73a73fe3654
Diffstat (limited to 'osprofiler/cmd')
-rw-r--r--osprofiler/cmd/commands.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/osprofiler/cmd/commands.py b/osprofiler/cmd/commands.py
index 469a94d..bc3de7e 100644
--- a/osprofiler/cmd/commands.py
+++ b/osprofiler/cmd/commands.py
@@ -155,11 +155,15 @@ class TraceCommands(BaseCommand):
return dot
@cliutils.arg("--connection-string", dest="conn_str",
- default=(cliutils.env("OSPROFILER_CONNECTION_STRING")),
+ default=cliutils.env("OSPROFILER_CONNECTION_STRING"),
required=True,
help="Storage driver's connection string. Defaults to "
"env[OSPROFILER_CONNECTION_STRING] if set")
+ @cliutils.arg("--error-trace", dest="error_trace",
+ type=bool, default=False,
+ help="List all traces that contain error.")
def list(self, args):
+ """List all traces"""
try:
engine = base.get_driver(args.conn_str, **args.__dict__)
except Exception as e:
@@ -168,7 +172,10 @@ class TraceCommands(BaseCommand):
fields = ("base_id", "timestamp")
pretty_table = prettytable.PrettyTable(fields)
pretty_table.align = "l"
- traces = engine.list_traces(fields)
+ if not args.error_trace:
+ traces = engine.list_traces(fields)
+ else:
+ traces = engine.list_error_traces()
for trace in traces:
row = [trace[field] for field in fields]
pretty_table.add_row(row)