Skip to content

Commit

Permalink
Start lvl at 0
Browse files Browse the repository at this point in the history
  • Loading branch information
bonnefoa committed Oct 16, 2024
1 parent 0484fe4 commit d3a39fc
Show file tree
Hide file tree
Showing 28 changed files with 719 additions and 707 deletions.
40 changes: 20 additions & 20 deletions expected/cursor.out
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,26 @@ SELECT :span_d_start >= :span_c_start as nested_declare_starts_after_parent,
SELECT span_type, span_operation, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001';
span_type | span_operation | lvl
------------------+-----------------------------------------------------+-----
TransactionBlock | TransactionBlock | 1
Utility query | BEGIN; | 2
ProcessUtility | ProcessUtility | 3
Utility query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 2
ProcessUtility | ProcessUtility | 3
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 4
Planner | Planner | 5
Utility query | FETCH FORWARD 20 from c | 2
ProcessUtility | ProcessUtility | 3
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 4
ExecutorRun | ExecutorRun | 5
Utility query | FETCH BACKWARD 10 from c | 2
ProcessUtility | ProcessUtility | 3
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 4
ExecutorRun | ExecutorRun | 5
Utility query | CLOSE c; | 2
ProcessUtility | ProcessUtility | 3
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 4
Utility query | COMMIT; | 2
ProcessUtility | ProcessUtility | 3
TransactionBlock | TransactionBlock | 0
Utility query | BEGIN; | 1
ProcessUtility | ProcessUtility | 2
Utility query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 1
ProcessUtility | ProcessUtility | 2
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 3
Planner | Planner | 4
Utility query | FETCH FORWARD 20 from c | 1
ProcessUtility | ProcessUtility | 2
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 3
ExecutorRun | ExecutorRun | 4
Utility query | FETCH BACKWARD 10 from c | 1
ProcessUtility | ProcessUtility | 2
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 3
ExecutorRun | ExecutorRun | 4
Utility query | CLOSE c; | 1
ProcessUtility | ProcessUtility | 2
Select query | DECLARE c CURSOR FOR SELECT * from pg_tracing_test; | 3
Utility query | COMMIT; | 1
ProcessUtility | ProcessUtility | 2
(20 rows)

-- Clean created spans
Expand Down
202 changes: 101 additions & 101 deletions expected/extended.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ SELECT $1, $2 \bind 1 2 \g
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
--------------+----------------+------------+-----
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {1,2} | 0
Planner | Planner | | 1
ExecutorRun | ExecutorRun | | 1
Result | Result | | 2
(4 rows)

CALL clean_spans();
Expand All @@ -24,12 +24,12 @@ ROLLBACK;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
------------------+------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | select $1 | | 2
Utility query | ROLLBACK; | | 1
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | select $1 | | 1
Utility query | ROLLBACK; | | 0
ProcessUtility | ProcessUtility | | 1
(6 rows)

CALL clean_spans();
Expand Down Expand Up @@ -67,28 +67,28 @@ SELECT count(distinct(trace_id)) = 1 FROM pg_tracing_peek_spans;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
------------------+------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2 | {2,3} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Utility query | COMMIT; | | 2
ProcessUtility | ProcessUtility | | 3
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Utility query | COMMIT; | | 2
ProcessUtility | ProcessUtility | | 3
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(22 rows)

CALL clean_spans();
Expand Down Expand Up @@ -123,23 +123,23 @@ SELECT count(distinct(trace_id)) = 1 FROM pg_tracing_peek_spans;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
------------------+--------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2, $3; | {5,6,7} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2 | {2,3} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Utility query | COMMIT; | | 2
ProcessUtility | ProcessUtility | | 3
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3; | {5,6,7} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(17 rows)

CALL clean_spans();
Expand All @@ -153,12 +153,12 @@ SELECT 1 \gdesc
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans;
span_type | span_operation | parameters | lvl
--------------+--------------------------------------------------------------------+----------------------+-----
Select query | SELECT $1 | {1} | 1
Select query | SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"+| {'?column?','23',-1} | 1
Select query | SELECT $1 | {1} | 0
Select query | SELECT name AS "Column", pg_catalog.format_type(tp, tpm) AS "Type"+| {'?column?','23',-1} | 0
| FROM (VALUES ($1, $2::pg_catalog.oid,$3)) s(name, tp, tpm) | |
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Planner | Planner | | 1
ExecutorRun | ExecutorRun | | 1
Result | Result | | 2
(5 rows)

CALL clean_spans();
Expand Down Expand Up @@ -188,23 +188,23 @@ COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000001';
span_type | span_operation | parameters | lvl
------------------+-------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2 | {1,2} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2, $3 | {1,2,3} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Utility query | COMMIT; | | 2
ProcessUtility | ProcessUtility | | 3
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(17 rows)

-- Test tracing only individual statements with extended protocol
Expand All @@ -231,19 +231,19 @@ COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000002';
span_type | span_operation | parameters | lvl
------------------+-------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2 | {1,2} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2, $3 | {1,2,3} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
TransactionBlock | TransactionBlock | | 0
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2 | {1,2} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(13 rows)

-- Test tracing only subset of individual statements with extended protocol
Expand Down Expand Up @@ -276,15 +276,15 @@ COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000003';
span_type | span_operation | parameters | lvl
------------------+-------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Select query | SELECT $1, $2, $3 | {1,2,3} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
TransactionBlock | TransactionBlock | | 0
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Select query | SELECT $1, $2, $3 | {1,2,3} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
(9 rows)

-- Test tracing the whole transaction with extended protocol with BEGIN sent through extended protocol
Expand All @@ -299,15 +299,15 @@ COMMIT;
SELECT span_type, span_operation, parameters, lvl FROM peek_ordered_spans WHERE trace_id='00000000000000000000000000000004';
span_type | span_operation | parameters | lvl
------------------+------------------+------------+-----
TransactionBlock | TransactionBlock | | 1
Utility query | BEGIN; | | 2
ProcessUtility | ProcessUtility | | 3
Select query | SELECT $1 | {1} | 2
Planner | Planner | | 3
ExecutorRun | ExecutorRun | | 3
Result | Result | | 4
Utility query | COMMIT; | | 2
ProcessUtility | ProcessUtility | | 3
TransactionBlock | TransactionBlock | | 0
Utility query | BEGIN; | | 1
ProcessUtility | ProcessUtility | | 2
Select query | SELECT $1 | {1} | 1
Planner | Planner | | 2
ExecutorRun | ExecutorRun | | 2
Result | Result | | 3
Utility query | COMMIT; | | 1
ProcessUtility | ProcessUtility | | 2
(9 rows)

-- Cleanup
Expand Down
Loading

0 comments on commit d3a39fc

Please sign in to comment.