Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/http_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,8 @@ template <class Id>
ngx_int_t hexIdVar(ngx_http_request_t* r, ngx_http_variable_value_t* v,
uintptr_t data)
{
namespace nostd = opentelemetry::nostd;

auto ctx = ensureOtelCtx(r);
if (!ctx) {
return NGX_ERROR;
Expand All @@ -867,13 +869,13 @@ ngx_int_t hexIdVar(ngx_http_request_t* r, ngx_http_variable_value_t* v,
auto id = (Id*)((char*)ctx + data);

if (id->IsValid()) {
auto size = id->Id().size() * 2;
constexpr auto size = 2 * Id::kSize;
auto buf = (char*)ngx_pnalloc(r->pool, size);
if (buf == NULL) {
return NGX_ERROR;
}

id->ToLowerBase16({buf, size});
id->ToLowerBase16(nostd::span<char, size>{buf, size});

v->len = size;
v->valid = 1;
Expand Down
5 changes: 3 additions & 2 deletions src/trace_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ struct TraceContext {
static void serialize(const TraceContext& tc, char* out)
{
using namespace opentelemetry::trace::propagation;
namespace nostd = opentelemetry::nostd;

*out++ = '0';
*out++ = '0';
*out++ = '-';

tc.traceId.ToLowerBase16({out, kTraceIdSize});
tc.traceId.ToLowerBase16(nostd::span<char, kTraceIdSize>{out, kTraceIdSize});
out += kTraceIdSize;
*out++ = '-';

tc.spanId.ToLowerBase16({out, kSpanIdSize});
tc.spanId.ToLowerBase16(nostd::span<char, kSpanIdSize>{out, kSpanIdSize});
out += kSpanIdSize;
*out++ = '-';

Expand Down