From 9d3dcb800aba0c036b032ccd00197712c3f5d0d9 Mon Sep 17 00:00:00 2001 From: Ava Hahn Date: Thu, 7 Nov 2024 14:14:28 -0800 Subject: otel: add build tooling to include otel code Adds the --otel flag to the configure command and the various build time variables and checks that are needed in this flow. It also includes the nxt_otel.c and nxt_otel.h files that are needed for the rest of Unit to talk to the compiled static library that's generated from the rust crate. Signed-off-by: Ava Hahn Co-authored-by: Gabor Javorszky Signed-off-by: Gabor Javorszky --- src/nxt_http_request.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index a7e9ff69..417b5a39 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -6,6 +6,7 @@ #include #include +#include static nxt_int_t nxt_http_validate_host(nxt_str_t *host, nxt_mp_t *mp); @@ -284,6 +285,16 @@ nxt_http_request_create(nxt_task_t *task) r->tstr_cache.var.pool = mp; +#if (NXT_HAVE_OTEL) + if (nxt_otel_rs_is_init()) { + r->otel = nxt_mp_zget(r->mem_pool, sizeof(nxt_otel_state_t)); + if (nxt_slow_path(r->otel == NULL)) { + goto fail; + } + r->otel->status = NXT_OTEL_INIT_STATE; + } +#endif + return r; fail: -- cgit From b9066210ac378a6255c1e3de5fc01ee29904a05c Mon Sep 17 00:00:00 2001 From: Ava Hahn Date: Wed, 23 Oct 2024 16:30:39 -0700 Subject: otel: add header parsing and test call state Enables Unit to parse the tracestate and traceparent headers and add it to the list, as well as calls to nxt_otel_test_and_call_state. Signed-off-by: Ava Hahn Signed-off-by: Gabor Javorszky --- src/nxt_http_request.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nxt_http_request.c') diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c index 417b5a39..722197b8 100644 --- a/src/nxt_http_request.c +++ b/src/nxt_http_request.c @@ -322,6 +322,8 @@ nxt_http_request_start(nxt_task_t *task, void *obj, void *data) r = obj; + NXT_OTEL_TRACE(); + r->state = &nxt_http_request_body_state; skcf = r->conf->socket_conf; @@ -593,6 +595,8 @@ nxt_http_request_ready(nxt_task_t *task, void *obj, void *data) r = obj; action = r->conf->socket_conf->action; + NXT_OTEL_TRACE(); + if (r->chunked) { ret = nxt_http_request_chunked_transform(r); if (nxt_slow_path(ret != NXT_OK)) { -- cgit