-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate HTTP trace context in Go (#491)
- Loading branch information
Showing
109 changed files
with
1,153 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
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
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,8 +1,6 @@ | ||
#ifndef TRACE_UTIL_H | ||
#define TRACE_UTIL_H | ||
|
||
#include "utils.h" | ||
|
||
// 55+13 | ||
#define TRACE_PARENT_HEADER_LEN 68 | ||
|
||
|
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,18 +1,41 @@ | ||
#ifndef TRACING_H | ||
#define TRACING_H | ||
#include "vmlinux.h" | ||
#include "trace_util.h" | ||
|
||
#define TRACE_ID_SIZE_BYTES 16 | ||
#define SPAN_ID_SIZE_BYTES 8 | ||
#define FLAGS_SIZE_BYTES 1 | ||
#define TRACE_ID_CHAR_LEN 32 | ||
#define SPAN_ID_CHAR_LEN 16 | ||
#define FLAGS_CHAR_LEN 2 | ||
#define TP_MAX_VAL_LENGTH 55 | ||
#define TP_MAX_KEY_LENGTH 11 | ||
|
||
typedef struct tp_info { | ||
unsigned char trace_id[TRACE_ID_SIZE_BYTES]; | ||
unsigned char span_id[SPAN_ID_SIZE_BYTES]; | ||
unsigned char parent_id[SPAN_ID_SIZE_BYTES]; | ||
u64 epoch; | ||
u8 flags; | ||
} tp_info_t; | ||
|
||
static __always_inline void make_tp_string(unsigned char *buf, tp_info_t *tp) { | ||
// Version | ||
*buf++ = '0'; *buf++ = '0'; *buf++ = '-'; | ||
|
||
// TraceID | ||
encode_hex(buf, tp->trace_id, TRACE_ID_SIZE_BYTES); | ||
buf += TRACE_ID_CHAR_LEN; | ||
*buf++ = '-'; | ||
|
||
// SpanID | ||
encode_hex(buf, tp->span_id, SPAN_ID_SIZE_BYTES); | ||
buf += SPAN_ID_CHAR_LEN; | ||
*buf++ = '-'; | ||
|
||
// Flags | ||
*buf++ = '0'; *buf = (tp->flags == 0) ? '0' : '1'; | ||
} | ||
|
||
#endif |
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 |
---|---|---|
|
@@ -27,6 +27,10 @@ | |
], | ||
"context.valueCtx": [ | ||
"val" | ||
], | ||
"bufio.Writer": [ | ||
"buf", | ||
"n" | ||
] | ||
} | ||
}, | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
none [integrity] confidentiality |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.