mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
common: Add a tree checker for trace spans
Trace spans form a tree, but we don't actually check that the structure doesn't break. Breakage can for example come if we use the same key accidentally, making a new span its own ancestor.
This commit is contained in:
parent
2e59ab8f15
commit
a6c81d4174
@ -264,6 +264,7 @@ void trace_span_start(const char *name, const void *key)
|
|||||||
|
|
||||||
current = s;
|
current = s;
|
||||||
DTRACE_PROBE1(lightningd, span_start, s->id);
|
DTRACE_PROBE1(lightningd, span_start, s->id);
|
||||||
|
trace_check_tree();
|
||||||
}
|
}
|
||||||
|
|
||||||
void trace_span_remote(u8 trace_id[TRACE_ID_SIZE], u8 span_id[SPAN_ID_SIZE])
|
void trace_span_remote(u8 trace_id[TRACE_ID_SIZE], u8 span_id[SPAN_ID_SIZE])
|
||||||
@ -283,6 +284,8 @@ void trace_span_end(const void *key)
|
|||||||
DTRACE_PROBE1(lightningd, span_end, s->id);
|
DTRACE_PROBE1(lightningd, span_end, s->id);
|
||||||
trace_emit(s);
|
trace_emit(s);
|
||||||
|
|
||||||
|
trace_check_tree();
|
||||||
|
|
||||||
/* Reset the context span we are in. */
|
/* Reset the context span we are in. */
|
||||||
current = s->parent;
|
current = s->parent;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user