summaryrefslogtreecommitdiffstats
path: root/clover/tracing/tracing_sample.py
diff options
context:
space:
mode:
authorStephen Wong <stephen.kf.wong@gmail.com>2018-03-30 06:22:48 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-30 06:22:48 +0000
commit41be5e066a37eb44d7f64372901f8d2760ab4e13 (patch)
tree62c55005c95c67a22adb807e1e3e112a1929b95d /clover/tracing/tracing_sample.py
parent9423f2e5911a9933744e827c9b09e2e9025b4aee (diff)
parent45ff7042f3909c32d6282e3bc31be650ba1a41c7 (diff)
Merge "Initial commit for tracing"
Diffstat (limited to 'clover/tracing/tracing_sample.py')
-rw-r--r--clover/tracing/tracing_sample.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/clover/tracing/tracing_sample.py b/clover/tracing/tracing_sample.py
new file mode 100644
index 0000000..f0234bf
--- /dev/null
+++ b/clover/tracing/tracing_sample.py
@@ -0,0 +1,47 @@
+# Copyright (c) Authors of Clover
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+import uuid
+import time
+from tracing import Tracing
+
+t = Tracing('localhost', '30888')
+
+# Get toplevel services stored in tracing
+services = t.getServices()
+print(services)
+
+# Get traces from the last hour for istio-ingress service
+service = 'istio-ingress'
+traces = t.getTraces(service, 3600)
+# Get process names for first trace service
+t.outProcesses(traces)
+
+# Turn off redis tracing store and output basic trace info
+t.use_redis = False
+t.outTraces(traces)
+
+# Setup basic test and store in redis
+t.use_redis = True
+t.setTest(uuid.uuid4())
+time.sleep(20)
+# Get all traces from test start time when time_back=0
+traces = t.getTraces(service, 0)
+# Store traces in redis
+t.outTraces(traces)
+
+# Get test id for some number of tests back
+testid = t.getRedisTestid('0')
+print(testid)
+traceids = t.getRedisTraceids(testid)
+print(traceids)
+
+# Print out span and tag info for all traces in test
+# Will continue to consider what to extract from hashes for e2e validation
+t.getRedisTestAll(testid)
+
+# t.monitorTraces(1)