Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump apache httpd and nginx instrumentation to latest version #3488

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

davidspek
Copy link

Description:
Updates apache httpd and nginx instrumentation to the latest version.

Link to tracking Issue(s):

Testing:

Documentation:

@davidspek davidspek requested a review from a team as a code owner November 22, 2024 17:10
@@ -549,7 +549,7 @@ List of all available attributes can be found at [otel-webserver-module](https:/

#### Using Nginx autoinstrumentation

For `Nginx` autoinstrumentation, Nginx versions 1.22.0, 1.23.0, and 1.23.1 are supported at this time. The Nginx configuration file is expected to be `/etc/nginx/nginx.conf` by default, if it's different, see following example on how to change it. Instrumentation at this time also expects, that `conf.d` directory is present in the directory, where configuration file resides and that there is a `include <config-file-dir-path>/conf.d/*.conf;` directive in the `http { ... }` section of Nginx configuration file (like it is in the default configuration file of Nginx). You can also adjust OpenTelemetry SDK attributes. Example:
For `Nginx` autoinstrumentation, Nginx versions 1.22.0, 1.23.0, 1.23.1, 1.24.0, 1.25.3, 1.25.5, and 1.26.0 are supported at this time. The Nginx configuration file is expected to be `/etc/nginx/nginx.conf` by default, if it's different, see following example on how to change it. Instrumentation at this time also expects, that `conf.d` directory is present in the directory, where configuration file resides and that there is a `include <config-file-dir-path>/conf.d/*.conf;` directive in the `http { ... }` section of Nginx configuration file (like it is in the default configuration file of Nginx). You can also adjust OpenTelemetry SDK attributes. Example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you confident all of these versions are actually supported? When we previously bumped this, there was some disagreement over this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just basing this off of the release notes. 1.24.0 and 1.25.3 were added in 1.0.4 and 1.26.0 and 1.25.5 were added in 1.1.0. Support for 1.22.0, 1.23.0, and 1.23.1 correspond with the release notes for version 1.0.2, and in 1.0.3 no change in supported versions was noted. So it seems like the supported versions weren't added for the 1.0.4 release. But I'm purely basing this off the notes here. I haven't actually deployed or tested anything yet, I just noted the outdated version and thought I'd help update it as it seemed simple enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the instrumentation we test the least, so I'm always a bit more cautious when the version is bumped. For example, if you look at the README, it claims to only support 1.24 and 1.25.

On the other hand, it looks like this was already the case for 1.0.4, which we blindly upgraded to without any complaints, so maybe this instrumentation simply isn't used that much, or its users carefully set the image tag in their CRs.

@pavolloffay @jaronoff97 @frzifus WDYT? Do we just bite the bullet and upgrade?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swiatekm I just checked the created container and it the versions 1.25.5 and 1.26.0 in it for NGINX.

@116davinder
Copy link

I am wiling to test it if otel add the supports for 1.26.x version at least. Currently, i see error that so nginx..xxxx.so file is missing after integrating auto-instrumentation.
btw, I am using nginx:1.26-alpine image so don't know if that is even supported or not as some docs say, I should build separate image with some otel special modules into nginx.

@davidspek
Copy link
Author

@116davinder Just a note that I had an issue with nginx:1.26.0-alpine where it was missing the libcrypt.so.1 library.

@116davinder
Copy link

116davinder commented Nov 27, 2024

Annotations

apiVersion: v1
kind: Pod
metadata:
  annotations:
    instrumentation.opentelemetry.io/container-names: test-example-api-pod
    instrumentation.opentelemetry.io/inject-nginx: opentelemetry-operator-system/auto-instrumentation
    resource.opentelemetry.io/service.name: test-example-api

Nginx Image: nginx:1.26-alpine

Main Nginx Container Startup Error

2024/11/27 17:56:23 [emerg] 1#1: dlopen() "/opt/opentelemetry-webserver/agent/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so" failed (Error loading shared library /opt/opentelemetry-webserver/agent/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so: No such file or directory) in /etc/nginx/nginx.conf:2
nginx: [emerg] dlopen() "/opt/opentelemetry-webserver/agent/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so" failed (Error loading shared library /opt/opentelemetry-webserver/agent/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so: No such file or directory) in /etc/nginx/nginx.conf:2

otel-attach-nginx container logs

NGINX_AGENT_DIR_FULL=$1
NGINX_AGENT_CONF_DIR_FULL=$2
NGINX_CONFIG_FILE=$3
NGINX_SID_PLACEHOLDER=$4
NGINX_SID_VALUE=$5
echo "Input Parameters: $@"
set -x
cp -r /opt/opentelemetry/VERSION.txt /opt/opentelemetry/WebServerModule /opt/opentelemetry/conf /opt/opentelemetry/install.sh /opt/opentelemetry/logs /opt/opentelemetry/sdk_lib ${NGINX_AGENT_DIR_FULL}
NGINX_VERSION=$(cat ${NGINX_AGENT_CONF_DIR_FULL}/version.txt)
NGINX_AGENT_LOG_DIR=$(echo "${NGINX_AGENT_DIR_FULL}/logs" | sed 's,/,\/,g')
cat ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml.template | sed 's,__agent_log_dir__,'${NGINX_AGENT_LOG_DIR}',g' > ${NGINX_AGENT_DIR_FULL}/conf/opentelemetry_sdk_log4cxx.xml
echo -e $OTEL_NGINX_AGENT_CONF > ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf
sed -i "s,${NGINX_SID_PLACEHOLDER},${OTEL_NGINX_SERVICE_INSTANCE_ID},g" ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf
sed -i "1s,^,load_module ${NGINX_AGENT_DIR_FULL}/WebServerModule/Nginx/${NGINX_VERSION}/ngx_http_opentelemetry_module.so;\n,g" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE}
sed -i "1s,^,env OTEL_RESOURCE_ATTRIBUTES;\n,g" ${NGINX_AGENT_CONF_DIR_FULL}/${NGINX_CONFIG_FILE}
mv ${NGINX_AGENT_CONF_DIR_FULL}/opentelemetry_agent.conf ${NGINX_AGENT_CONF_DIR_FULL}/conf.d
Input Parameters: /opt/opentelemetry-webserver/agent /opt/opentelemetry-webserver/source-conf nginx.conf <<SID-PLACEHOLDER>>
+ cp -r /opt/opentelemetry/VERSION.txt /opt/opentelemetry/WebServerModule /opt/opentelemetry/conf /opt/opentelemetry/install.sh /opt/opentelemetry/logs /opt/opentelemetry/sdk_lib /opt/opentelemetry-webserver/agent
+ cat /opt/opentelemetry-webserver/source-conf/version.txt
+ NGINX_VERSION=1.26.2
+ echo /opt/opentelemetry-webserver/agent/logs
+ sed 's,/,\/,g'
+ NGINX_AGENT_LOG_DIR=/opt/opentelemetry-webserver/agent/logs
+ cat /opt/opentelemetry-webserver/agent/conf/opentelemetry_sdk_log4cxx.xml.template
+ sed s,__agent_log_dir__,/opt/opentelemetry-webserver/agent/logs,g
+ echo -e NginxModuleEnabled 'ON;' NginxModuleOtelExporterEndpoint 'http://opentelemetry-collector.opentelemetry-operator-system:4318;' NginxModuleOtelSpanExporter 'otlp;' NginxModuleResolveBackends 'ON;' NginxModuleServiceInstanceId '<<SID-PLACEHOLDER>>;' NginxModuleServiceName 'test-example-api;' NginxModuleServiceNamespace 'test-frontend;' NginxModuleTraceAsError 'ON;'
+ sed -i 's,<<SID-PLACEHOLDER>>,test-example-api-deployment-857f6b6b8b-ndnrt,g' /opt/opentelemetry-webserver/source-conf/opentelemetry_agent.conf
+ sed -i '1s,^,load_module /opt/opentelemetry-webserver/agent/WebServerModule/Nginx/1.26.2/ngx_http_opentelemetry_module.so;\n,g' /opt/opentelemetry-webserver/source-conf/nginx.conf
+ sed -i '1s,^,env OTEL_RESOURCE_ATTRIBUTES;\n,g' /opt/opentelemetry-webserver/source-conf/nginx.conf
+ mv /opt/opentelemetry-webserver/source-conf/opentelemetry_agent.conf /opt/opentelemetry-webserver/source-conf/conf.d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump Apache httpd version
3 participants