utils/telemetry: Export to console in --debug mode
By default, local telemetry gathering is initialized to export to
clearcut only. For local testing and debugging, add a second span
exporter when --debug is supplied.
BUG=b:279775872
TEST=./scripts/telemetry_poc --debug
Change-Id: Ic6e6d7417a0499bc8578895409fece1dd8e2f6cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4504253
Commit-Queue: Alex Klein <saklein@chromium.org>
Auto-Submit: Lizzy Presland <zland@google.com>
Tested-by: Lizzy Presland <zland@google.com>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/telemetry_poc.py b/scripts/telemetry_poc.py
index 82b0cc4..a513463 100644
--- a/scripts/telemetry_poc.py
+++ b/scripts/telemetry_poc.py
@@ -47,6 +47,10 @@
def main(argv: Optional[List[str]]) -> Optional[int]:
"""Main."""
opts = parse_arguments(argv)
+
+ if opts.debug:
+ telemetry.export_to_console()
+
with tracer.start_as_current_span("test") as span:
time.sleep(opts.time / 2)
span.add_event(name="mid-sleep-event", attributes={"attr": "val"})