-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Turn that visualization hack into a feature #12
Labels
enhancement
New feature or request
Comments
def visualize_traces(traces, chars=80):
start = min(t[1] for t in traces)
end = max(t[2] for t in traces)
width = end - start
pos = lambda value1, value2: int((value1 - value2) * chars / width)
for trace in traces:
name, p1, p2 = trace[0], pos(trace[1], start), pos(trace[2], trace[1])
print("{}: started {:5f}, took {:5f}".format(name, trace[1] - start, trace[2] - trace[1]))
print(' ' * p1, '*' * p2) Output looks like this:
|
That's when run against data collected using this pattern: registry = Registry(a, b, c, d)
collected = []
registry.timer = lambda name, start, end: collected.append((name, start, end))
await registry.resolve(d)
visualize_traces(collected) |
This almost feels like a tracing API. I wonder if it could just be made compatible with OpenTelemetry so that existing tooling could be used for visualization? |
My hope is that the |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Hack from:
The text was updated successfully, but these errors were encountered: