diff --git a/CHANGES b/CHANGES index c79ea040e..ba28f6923 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,12 @@ +Changes with Unit 1.34.1 10 Jan 2025 + + *) Bugfix: fix instability issues due to OpenTelemetry (OTEL) support. + + *) Bugfix: fix issues with building OpenTelemetry (OTEL) support on + various platforms, including macOS. + + Changes with Unit 1.34.0 19 Dec 2024 *) Feature: initial OpenTelemetry (OTEL) support. (Disabled by default). diff --git a/auto/make b/auto/make index 183e95c75..4320f6299 100644 --- a/auto/make +++ b/auto/make @@ -15,19 +15,20 @@ PP_AR := @echo ' AR ' PP_LD := @echo ' LD ' PP_VER := @echo ' VER ' PP_SED := @echo ' SED ' +PP_CR := @echo ' CR ' CC = $CC AR = $AR EXTRA_CFLAGS = CFLAGS = $NXT_CFLAGS $NXT_CC_OPT $CFLAGS \$(EXTRA_CFLAGS) -RUST_FLAGS = -NXT_OTEL_LIB_LOC = NXT_EXEC_LINK = $NXT_EXEC_LINK $NXT_LD_OPT NXT_SHARED_LOCAL_LINK = $NXT_SHARED_LOCAL_LINK $NXT_LD_OPT NXT_MODULE_LINK = $NXT_MODULE_LINK +NXT_OTEL_LIB_STATIC = + all: $NXT_DAEMON manpage .PHONY: $NXT_DAEMON manpage @@ -37,6 +38,18 @@ manpage: $NXT_BUILD_DIR/share/man/man8/unitd.8 END +if [ $NXT_OTEL = YES ]; then + + cat << END >> $NXT_MAKEFILE + +RUST_FLAGS = --release +NXT_OTEL_LIB_STATIC = $NXT_BUILD_DIR/lib/libotel.a + +END + +fi + + NXT_OS=$(uname -s) NXT_GNU_MAKE=$(make --version | grep GNU || true) @@ -63,9 +76,7 @@ D := 0 ifeq (\$D,1) CFLAGS += -O0 - RUST_FLAGS += --debug -else - RUST_FLAGS += --release + RUST_FLAGS = endif # Optionally disable -Werror with @@ -80,18 +91,6 @@ END fi -# potentially set otel lib location -if [ $NXT_OTEL = YES ]; then -cat << END >> $NXT_MAKEFILE - -ifeq (\$D,1) - NXT_OTEL_LIB_LOC = $NXT_OTEL_LIB_DIR/target/debug/libotel.a -else - NXT_OTEL_LIB_LOC = $NXT_OTEL_LIB_DIR/target/release/libotel.a -endif - -END -fi # The include paths list. @@ -154,14 +153,15 @@ cat << END >> $NXT_MAKEFILE libnxt: $NXT_BUILD_DIR/lib/$NXT_LIB_SHARED $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC -$NXT_BUILD_DIR/lib/$NXT_LIB_SHARED: \$(NXT_LIB_OBJS) \$(NXT_OTEL_LIB_LOC) +$NXT_BUILD_DIR/lib/$NXT_LIB_SHARED: \$(NXT_LIB_OBJS) \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(NXT_SHARED_LOCAL_LINK) -o \$@ \$(NXT_LIB_OBJS) \\ - $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS \$(NXT_OTEL_LIB_LOC) + \$(NXT_OTEL_LIB_STATIC) \\ + $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS -$NXT_BUILD_DIR/lib/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS) \$(NXT_OTEL_LIB_LOC) +$NXT_BUILD_DIR/lib/$NXT_LIB_STATIC: \$(NXT_LIB_OBJS) \$(PP_AR) \$@ - \$(v)$NXT_STATIC_LINK \$@ \$(NXT_LIB_OBJS) \$(NXT_OTEL_LIB_LOC) + \$(v)$NXT_STATIC_LINK \$@ \$(NXT_LIB_OBJS) $NXT_BUILD_DIR/lib/$NXT_LIB_UNIT_STATIC: \$(NXT_LIB_UNIT_OBJS) \\ $NXT_BUILD_DIR/share/pkgconfig/unit.pc \\ @@ -264,36 +264,40 @@ tests: $NXT_BUILD_DIR/tests $NXT_BUILD_DIR/utf8_file_name_test \\ $NXT_BUILD_DIR/unit_websocket_echo $NXT_BUILD_DIR/tests: \$(NXT_TEST_OBJS) \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/tests \\ \$(CFLAGS) \$(NXT_TEST_OBJS) \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \$(NXT_OTEL_LIB_STATIC) \\ $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_BUILD_DIR/utf8_file_name_test: $NXT_LIB_UTF8_FILE_NAME_TEST_SRCS \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(CC) \$(CFLAGS) \$(NXT_LIB_INCS) $NXT_LIB_AUX_CFLAGS \\ -o $NXT_BUILD_DIR/utf8_file_name_test \\ $NXT_LIB_UTF8_FILE_NAME_TEST_SRCS \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \$(NXT_OTEL_LIB_STATIC) \\ $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_BUILD_DIR/ncq_test: $NXT_BUILD_DIR/src/test/nxt_ncq_test.o \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/ncq_test \\ \$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_ncq_test.o \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \$(NXT_OTEL_LIB_STATIC) \\ $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_BUILD_DIR/vbcq_test: $NXT_BUILD_DIR/src/test/nxt_vbcq_test.o \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(NXT_EXEC_LINK) -o $NXT_BUILD_DIR/vbcq_test \\ \$(CFLAGS) $NXT_BUILD_DIR/src/test/nxt_vbcq_test.o \\ - $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ + $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \$(NXT_OTEL_LIB_STATIC) \\ $NXT_LD_OPT $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS $NXT_BUILD_DIR/unit_app_test: $NXT_BUILD_DIR/src/test/nxt_unit_app_test.o \\ @@ -375,11 +379,12 @@ $echo >> $NXT_MAKEFILE cat << END >> $NXT_MAKEFILE $NXT_BUILD_DIR/sbin/$NXT_DAEMON: $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ - \$(NXT_OBJS) \$(NXT_OTEL_LIB_LOC) + \$(NXT_OBJS) \$(NXT_OTEL_LIB_STATIC) \$(PP_LD) \$@ \$(v)\$(NXT_EXEC_LINK) -o \$@ \$(CFLAGS) \\ \$(NXT_OBJS) $NXT_BUILD_DIR/lib/$NXT_LIB_STATIC \\ - $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS \$(NXT_OTEL_LIB_LOC) + \$(NXT_OTEL_LIB_STATIC) \\ + $NXT_LIBM $NXT_LIBS $NXT_LIB_AUX_LIBS END @@ -580,7 +585,10 @@ NXT_OTEL_DEPS=" \ cat << END >> $NXT_MAKEFILE -\$(NXT_OTEL_LIB_LOC): $NXT_OTEL_DEPS - cargo build \$(RUST_FLAGS) --manifest-path $NXT_OTEL_LIB_DIR/Cargo.toml +\$(NXT_OTEL_LIB_STATIC): $NXT_OTEL_DEPS + \$(PP_CR) \$@ + \$(v)cargo rustc \$(RUST_FLAGS) \\ + --manifest-path $NXT_OTEL_LIB_DIR/Cargo.toml \\ + -- --emit link=../../$NXT_BUILD_DIR/lib/libotel.a END fi diff --git a/auto/otel b/auto/otel index f23aac3b1..4d059a285 100644 --- a/auto/otel +++ b/auto/otel @@ -19,34 +19,44 @@ if [ $NXT_OTEL = YES ]; then fi $echo "found" - $echo -n " - " - - nxt_feature="OpenSSL library" - nxt_feature_run=yes - nxt_feature_incs= - nxt_feature_libs="-lssl -lcrypto" - nxt_feature_test="#include - - int main(void) { - SSL_library_init(); - return 0; - }" - . auto/feature - - if [ ! $nxt_found = yes ]; then - $echo - $echo $0: error: OpenTelemetry support requires OpenSSL. - $echo - exit 1; - fi + case "$NXT_SYSTEM" in + Darwin) + NXT_OTEL_LIBS="-framework CoreFoundation -framework Security -framework SystemConfiguration" - NXT_OTEL_LIBS="-lssl -lcrypto" - - cat << END >> $NXT_AUTO_CONFIG_H + cat << END >> $NXT_AUTO_CONFIG_H #ifndef NXT_HAVE_OTEL #define NXT_HAVE_OTEL 1 #endif END + ;; + *) + + $echo -n " - " + + nxt_feature="OpenSSL library" + nxt_feature_name=NXT_HAVE_OTEL + nxt_feature_run=yes + nxt_feature_incs= + nxt_feature_libs="-lssl -lcrypto" + nxt_feature_test="#include + + int main(void) { + SSL_library_init(); + return 0; + }" + . auto/feature + + if [ ! $nxt_found = yes ]; then + $echo + $echo $0: error: OpenTelemetry support requires OpenSSL. + $echo + exit 1; + fi + + NXT_OTEL_LIBS="-lssl -lcrypto" + ;; + esac + fi diff --git a/docs/changes.xml b/docs/changes.xml index d5cd5995d..e8151465b 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -5,6 +5,51 @@ + + + + +NGINX Unit updated to 1.34.1. + + + + + + + + + + +fix instability issues due to OpenTelemetry (OTEL) support. + + + + + +fix issues with building OpenTelemetry (OTEL) support on various platforms, +including macOS. + + + + + + otel->trace_id == NULL) { + } else { nxt_otel_rs_copy_traceparent(traceval, r->otel->trace); @@ -92,15 +92,6 @@ nxt_otel_propagate_header(nxt_task_t *task, nxt_http_request_t *r) nxt_otel_rs_add_event_to_trace(r->otel->trace, &traceparent_name, &traceparent); - - /* - * potentially nxt_http_request_error called before headers - * finished parsing - */ - } else { - nxt_log(task, NXT_LOG_DEBUG, - "not propagating tracing headers for missing trace"); - return; } f = nxt_list_add(r->resp.fields); @@ -311,17 +302,13 @@ nxt_otel_test_and_call_state(nxt_task_t *task, nxt_http_request_t *r) void nxt_otel_request_error_path(nxt_task_t *task, nxt_http_request_t *r) { - if (r->otel->trace == NULL) { + if (r->otel == NULL || r->otel->trace == NULL) { return; } // response headers have been cleared nxt_otel_propagate_header(task, r); - - // collect span immediately - if (r->otel) { - nxt_otel_state_transition(r->otel, NXT_OTEL_COLLECT_STATE); - } + nxt_otel_state_transition(r->otel, NXT_OTEL_COLLECT_STATE); nxt_otel_test_and_call_state(task, r); } @@ -344,6 +331,9 @@ nxt_otel_parse_traceparent(void *ctx, nxt_http_field_t *field, uintptr_t data) */ r = ctx; + if (r->otel == NULL) { + return NXT_OK; + } if (field->value_length != NXT_OTEL_TRACEPARENT_LEN) { goto error_state; @@ -391,6 +381,10 @@ nxt_otel_parse_tracestate(void *ctx, nxt_http_field_t *field, uintptr_t data) s.start = field->value; r = ctx; + if (r->otel == NULL) { + return NXT_OK; + } + r->otel->trace_state = s; /* diff --git a/tools/unitctl/Cargo.lock b/tools/unitctl/Cargo.lock index 79fd254bd..b28e591dc 100644 --- a/tools/unitctl/Cargo.lock +++ b/tools/unitctl/Cargo.lock @@ -2185,7 +2185,7 @@ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unit-client-rs" -version = "1.34.0" +version = "1.34.1" dependencies = [ "bollard", "custom_error", @@ -2208,7 +2208,7 @@ dependencies = [ [[package]] name = "unit-openapi" -version = "1.34.0" +version = "1.34.1" dependencies = [ "base64 0.21.7", "futures", @@ -2222,7 +2222,7 @@ dependencies = [ [[package]] name = "unitctl" -version = "1.34.0" +version = "1.34.1" dependencies = [ "clap", "colored_json", diff --git a/tools/unitctl/openapi-config.json b/tools/unitctl/openapi-config.json index 0986624a0..df0e6e859 100644 --- a/tools/unitctl/openapi-config.json +++ b/tools/unitctl/openapi-config.json @@ -1,6 +1,6 @@ { "packageName": "unit-openapi", - "packageVersion": "1.34.0", + "packageVersion": "1.34.1", "library": "hyper", "preferUnsignedInt": true } diff --git a/tools/unitctl/unit-client-rs/Cargo.toml b/tools/unitctl/unit-client-rs/Cargo.toml index 4fd770364..ce10231ae 100644 --- a/tools/unitctl/unit-client-rs/Cargo.toml +++ b/tools/unitctl/unit-client-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unit-client-rs" -version = "1.34.0" +version = "1.34.1" authors = ["Elijah Zupancic"] edition = "2021" license = "Apache-2.0" diff --git a/tools/unitctl/unit-openapi/Cargo.toml b/tools/unitctl/unit-openapi/Cargo.toml index 94d274c79..1b0b3bcfb 100644 --- a/tools/unitctl/unit-openapi/Cargo.toml +++ b/tools/unitctl/unit-openapi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unit-openapi" -version = "1.34.0" +version = "1.34.1" authors = ["unit-owner@nginx.org"] description = "NGINX Unit is a lightweight and versatile application runtime that provides the essential components for your web application as a single open-source server: running application code, serving static assets, handling TLS and request routing. **Important**: Unit's API is designed to expose any part of its configuration as an addressable endpoint. Suppose a JSON object is stored at `/config/listeners/`: ```json { \"*:8080\": { \"pass\": \"applications/wp_emea_dev\" } } ``` Here, `/config/listeners/_*:8080` and `/config/listeners/_*:8080/pass` are also endpoints. Generally, object options are addressable by their names, array items—by their indexes (`/array/0/`). **Note**: By default, Unit is configured through a UNIX domain socket. To use this specification with OpenAPI tools interactively, [start](https://unit.nginx.org/howto/source/#source-startup) Unit with a TCP port as the control socket." license = "Apache 2.0" diff --git a/tools/unitctl/unit-openapi/README.md b/tools/unitctl/unit-openapi/README.md index 327281856..e9de1a1c2 100644 --- a/tools/unitctl/unit-openapi/README.md +++ b/tools/unitctl/unit-openapi/README.md @@ -21,7 +21,7 @@ For more information, please visit [https://unit.nginx.org/](https://unit.nginx. This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. - API version: 0.2.0 -- Package version: 1.34.0 +- Package version: 1.34.1 - Generator version: 7.6.0 - Build package: `org.openapitools.codegen.languages.RustClientCodegen` diff --git a/tools/unitctl/unitctl/Cargo.toml b/tools/unitctl/unitctl/Cargo.toml index 82fa40680..02ac6043d 100644 --- a/tools/unitctl/unitctl/Cargo.toml +++ b/tools/unitctl/unitctl/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "unitctl" description = "CLI interface to the NGINX Unit Control API" -version = "1.34.0" +version = "1.34.1" authors = ["Elijah Zupancic"] edition = "2021" license = "Apache-2.0" diff --git a/version b/version index 970cacc03..99407a456 100644 --- a/version +++ b/version @@ -1,5 +1,5 @@ # Copyright (C) NGINX, Inc. -NXT_VERSION=1.34.0 -NXT_VERNUM=13400 +NXT_VERSION=1.34.1 +NXT_VERNUM=13401