-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc: Improve generated traces from common/trace.c
The integration with opentelemetry was sub-optimal: it was generating jaeger-style traces, with short traceIds and we were considering the entire lifetime as a single trace. This PR changes that to a trace for startup and then a trace for any event that doesn't already have a parent. We also allow using the `CLN_TRACEPARENT` envvar to attach the startup to a remote / external trace, potentially by whatever started the main process. This is useful to see the startup trace in the wider context of whatever tooling is built around it. Changelog-Added: tracing: It is now possible to inject a parent for the startup trace by setting the `CLN_TRACEPARENT` envvar
- Loading branch information
Showing
2 changed files
with
125 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
#ifndef LIGHTNING_COMMON_TRACE_H | ||
#define LIGHTNING_COMMON_TRACE_H | ||
#include "config.h" | ||
#include <ccan/short_types/short_types.h> | ||
|
||
#define SPAN_ID_SIZE 8 | ||
#define TRACE_ID_SIZE 16 | ||
|
||
void trace_span_start(const char *name, const void *key); | ||
void trace_span_end(const void *key); | ||
void trace_span_suspend(const void *key); | ||
void trace_span_resume(const void *key); | ||
void trace_span_tag(const void *key, const char *name, const char *value); | ||
|
||
void trace_span_remote(u8 trace_id[TRACE_ID_SIZE], u8 span_id[SPAN_ID_SIZE]); | ||
#endif /* LIGHTNING_COMMON_TRACE_H */ |