iquirino / nginx-opentelemetry

8 stars 2 forks source link

otel_ngx_module.so failed on alpine 1.16.0 #1

Open ballerabdude opened 2 years ago

ballerabdude commented 2 years ago

You will get the below error when using the latest alpine 1.16.0

docker run -it -v ${PWD}/nginx.conf:/etc/nginx/nginx.conf nginx-proxy sh     
/etc/nginx/nginx -g "daemon off;"
2022/06/08 15:10:48 [emerg] 7#0: dlopen() "/etc/nginx/modules/otel_ngx_module.so" failed (Error relocating /etc/nginx/modules/otel_ngx_module.so: _ZN4absl12lts_2021110216variant_internal21ThrowBadVariantAccessEv: symbol not found) in /etc/nginx/nginx.conf:1
nginx: [emerg] dlopen() "/etc/nginx/modules/otel_ngx_module.so" failed (Error relocating /etc/nginx/modules/otel_ngx_module.so: _ZN4absl12lts_2021110216variant_internal21ThrowBadVariantAccessEv: symbol not found) in /etc/nginx/nginx.conf:1

I compared the build from iquirino91/nginx-opentelemetry which at the time was using alpine 1.15.0

After changing FROM alpine TO FROM alpine:3.15.0 everything works.

Not sure what could have changed on the os level to break the build.

iquirino commented 2 years ago

I rolled out a new version on docker hub. Can you try it again? I didn't modified anything. It is using lates alpine version.

ballerabdude commented 2 years ago

I pulled the latest with no cache.

docker run -it --pull=always -v ${PWD}/nginx.conf:/etc/nginx/nginx.conf iquirino91/nginx-opentelemetry sh                                                                      
latest: Pulling from iquirino91/nginx-opentelemetry
Digest: sha256:0657199cb35d4e720f75ac70a09e3022c71f94a9a10ec32f7f2756b4c41ae6fe
Status: Image is up to date for iquirino91/nginx-opentelemetry:latest

/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.0
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

/ # /etc/nginx/nginx -v
nginx version: nginx/1.21.4
/ # /etc/nginx/nginx -g "daemon off;"
2022/06/08 16:45:04 [emerg] 10#0: dlopen() "/etc/nginx/modules/otel_ngx_module.so" failed (Error relocating /etc/nginx/modules/otel_ngx_module.so: _ZN4absl12lts_2021110216variant_internal21ThrowBadVariantAccessEv: symbol not found) in /etc/nginx/nginx.conf:1
nginx: [emerg] dlopen() "/etc/nginx/modules/otel_ngx_module.so" failed (Error relocating /etc/nginx/modules/otel_ngx_module.so: _ZN4absl12lts_2021110216variant_internal21ThrowBadVariantAccessEv: symbol not found) in /etc/nginx/nginx.conf:1
/ #

nginx.conf


load_module /etc/nginx/modules/otel_ngx_module.so;

events {}

http {
  opentelemetry_config /conf/otel-nginx.toml;
  access_log stderr;
  error_log stderr debug;

  upstream node-backend {
    server example.com:8001;
  }

  server {
    listen 8000;

    root /var/www/html;

    opentelemetry_attribute "test.attrib.global" "global";
    opentelemetry_attribute "test.attrib.custom" "global-custom";

    location = / {
      opentelemetry_operation_name $request_uri;
      opentelemetry_propagate;
      proxy_pass http://node-backend/;
    }
  } 
}`
iquirino commented 2 years ago

I will try to update nginx and open telemetry version

iquirino commented 2 years ago

Updated. Can you try again, please?

ballerabdude commented 2 years ago

I just pulled down the latest, and the issue is still there. During my initial debugging I actually started with the latest versions of all the libraries thinking that would fix the problem.

darkobas2 commented 1 year ago

Anyone figured this out ?

iquirino commented 1 year ago

I've pushed a new image with latest versions of otel and nginx, please pull it again and try it ;)

Fenkiou commented 1 year ago

Not working for me neither with a Dockerfile like this:

FROM iquirino91/nginx-opentelemetry
RUN echo "load_module /etc/nginx/modules/otel_ngx_module.so;$(cat /etc/nginx/nginx.conf)" > /etc/nginx/nginx.conf

Replaced FROM alpine with FROM alpine:3.15 in your Dockerfile resolved the issue as stated by @ballerabdude, alpine 3.16 and 3.17 does not seems to be working for some reason.

iquirino commented 1 year ago

I am pushing a new image with alpine:3.15 version fixed. I am currently without time to check it, if you have time to check why it broken, please share with us... I'll try to have some time to fix it on the lates version.

Thank you guys! ;)