diff options
| author | Ava Hahn <a.hahn@f5.com> | 2024-11-07 14:14:28 -0800 |
|---|---|---|
| committer | Ava Hahn <110854134+avahahn@users.noreply.github.com> | 2024-11-12 09:50:02 -0800 |
| commit | 9d3dcb800aba0c036b032ccd00197712c3f5d0d9 (patch) | |
| tree | 60492891a92e91e5a83040fd43a0513c0e093270 /auto/otel | |
| parent | 8b697101818d8d2257a5421d21020c02e0802907 (diff) | |
| download | unit-9d3dcb800aba0c036b032ccd00197712c3f5d0d9.tar.gz unit-9d3dcb800aba0c036b032ccd00197712c3f5d0d9.tar.bz2 | |
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 <a.hahn@f5.com>
Co-authored-by: Gabor Javorszky <g.javorszky@f5.com>
Signed-off-by: Gabor Javorszky <g.javorszky@f5.com>
Diffstat (limited to 'auto/otel')
| -rw-r--r-- | auto/otel | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/auto/otel b/auto/otel new file mode 100644 index 00000000..654c45ec --- /dev/null +++ b/auto/otel @@ -0,0 +1,54 @@ + +# Copyright (C) NGINX, Inc. + +if [ $NXT_OTEL = YES ]; then + + $echo "checking for OTEL requirements:" + + $echo -n " - checking for rust compiler ... " + if [ -z $(which rustc 2>/dev/null) ]; then + $echo "not found" + exit 1; + fi + $echo "found" + + $echo -n " - checking for cargo ... " + if [ -z $(which cargo 2>/dev/null) ]; then + $echo "not found." + exit 1; + 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 <openssl/ssl.h> + + 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" + if [ $(which pkg-config) ]; then + NXT_OTEL_LIBS="$(pkg-config openssl --cflags --libs)" + fi + cat << END >> $NXT_AUTO_CONFIG_H + +#ifndef NXT_HAVE_OTEL +#define NXT_HAVE_OTEL 1 +#endif + +END +fi |
