From 08a492ab13a00af2971430c993cd7635a0c9a795 Mon Sep 17 00:00:00 2001 From: Anthonin Bonnefoy Date: Wed, 16 Oct 2024 10:12:34 +0200 Subject: [PATCH] Added tree visualisation of spans Adapted from cwang9208's suggestion in #44 --- pg_tracing--0.1.0.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pg_tracing--0.1.0.sql b/pg_tracing--0.1.0.sql index bcbca3a..0b098d7 100644 --- a/pg_tracing--0.1.0.sql +++ b/pg_tracing--0.1.0.sql @@ -108,6 +108,11 @@ CREATE VIEW pg_tracing_peek_spans_with_level AS WHERE s.parent_id = st.span_id ) SELECT * FROM list_trace_spans; +CREATE VIEW pg_tracing_peek_spans_tree AS + SELECT trace_id, lpad(span_operation, length(span_operation) + lvl * 2, '_'), span_id, parent_id, span_start, span_end, lvl + FROM pg_tracing_peek_spans_with_level s + ORDER BY trace_id, span_start; + CREATE VIEW pg_tracing_consume_spans AS SELECT * FROM pg_tracing_spans(true);