open-telemetry / open-telemetry/opentelemetry-cpp-contrib

ubuntu 24.04 nginx 1.27.3 is unable to load the library

Open
#561 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug general
Dominant language
Python
Stars
153
Forks
184
Avg merge
2d 9h
Merged PRs (30d)
26

Description

Describe your environment
Ubuntu: 24.04
Nginx version: 1.27.3

Steps to reproduce
Dockerfile to build nginx image:

FROM ubuntu:24.04

ARG NGINX_VERSION="1.27.3"
ARG OPENTRACING_NGINX_VERSION="v0.40.0"

RUN apt-get update && apt-get upgrade -y 

RUN apt-get -y install \
    gnupg2 \
    wget 

# more info on installing nginx here - https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/
RUN wget -O - -o /dev/null https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] http://nginx.org/packages/mainline/ubuntu noble nginx" | tee /etc/apt/sources.list.d/nginx.list

RUN addgroup --system --gid 401 nginx \
    && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 402 nginx

RUN apt-get update 
    
RUN DEBIAN_FRONTEND="noninteractive" apt-get install nginx=${NGINX_VERSION}-1~noble tar libprotobuf-dev -y

RUN wget -O /usr/lib/nginx/modules/otel_ngx_module-ubuntu-24.04-1.27.3.so \
  https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/download/nginx%2Fv0.1.1/otel_ngx_module-ubuntu-24.04-1.27.3.so

RUN chmod 755 /usr/lib/nginx/modules/otel_ngx_module-ubuntu-24.04-1.27.3.so
# we don't want to run the default nginx server
RUN rm -rf /etc/nginx/conf.d/default.conf
RUN mkdir /var/lib/nginx/
RUN chown -R nginx:nginx /var/log/nginx
RUN chown -R nginx:nginx /var/lib/nginx
RUN chown -R nginx:nginx /var/cache/nginx
RUN apt purge wget gnupg2 -y

EXPOSE 443/tcp

CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

What is the expected behavior?
We expect the opentelemetry library to send traces to opentelemetry-collector

What is the actual behavior?
What did you see instead?
We see the following error and nginx doesn't start
nginx: [emerg] unknown directive "NginxModuleEnabled" in /etc/nginx/conf.d/opentelemetry_module.conf:1

Additional context
Here's our opentelemetry config:

      NginxModuleEnabled ON;
      NginxModuleOtelSpanExporter otlp;
      NginxModuleServiceName nginx;
      NginxModuleServiceNamespace nginx;
      NginxModuleServiceInstanceId nginx;
      NginxModuleResolveBackends ON;
      NginxModuleTraceAsError OFF;
      NginxModuleOtelSampler AlwaysOff;
      NginxModuleOtelScheduledDelayMillis 2000;
      NginxModuleOtelExporterEndpoint opentelemetry-collector.grafana:4317;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Dockerfile and the downloaded otel_ngx_module-ubuntu-24.04-1.27.3.so, then inspect how /etc/nginx/conf.d/opentelemetry_module.conf is loaded by nginx. Reproduce the unknown-directive error and determine why the module does not register the listed directives; done means nginx starts with this configuration and can send traces to the collector.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx, ubuntu
Domain
backend, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.