OpenTelemetry (OTel) is an observability framework for monitoring, tracing, troubleshooting, and optimizing applications. OTel enables the collection of telemetry data from a deployed application stack.
The nginx-plus-module-otel
module is an NGINX-authored dynamic module that enables NGINX Plus to send telemetry data to an OTel collector. The module supports W3C trace context propagation, OpenTelemetry Protocol (OTLP)/gRPC trace exports, and offers several advantages over existing OTel modules including:
Enhanced performance: with the module enabled, request processing overhead is limited to 10-15%, compared to other OpenTelemetry implementations, which can introduce performance degradation of up to 50%.
Simplified provisioning through NGINX configuration file.
Dynamic, variable-based control of trace parameters with cookies, tokens, and variables. See Ratio-based Tracing example for details.
Dynamic control of sampling parameters via the NGINX Plus API and key-value storage.
The source code for the module is available in the official GitHub repository. The official documentation, including module reference and usage examples, is available on the nginx.org website.
The OpenTelemetry module supersedes the deprecated OpenTracing module which was available until NGINX Plus Release 34.
The installation process closely follows the NGINX Plus installation procedure. The module is available as the prebuilt nginx-plus-module-otel
package for various Linux distributions and can be installed directly from the official NGINX Plus repository. Prior to installation, you need to add the NGINX Plus package repository for your distribution and update the repository metadata.
Check the Technical Specifications page to verify that the module is supported by your operating system.
The OpenTelemetry module cannot be installed on Amazon Linux 2 LTS and SLES 15 SP5+.
The OpenTelemetry module cannot be installed on Amazon Linux 2 LTS and SLES 15 SP5+.
Make sure you have the latest version of NGINX Plus. In Terminal, run the command:
Expected output of the command:
nginx version: nginx/1.29.0 (nginx-plus-r35)
nginx version: nginx/1.29.0 (nginx-plus-r35)
Ensure you have the nginx-repo.crt and nginx-repo.key files from MyF5 Customer Portal in the /etc/ssl/nginx/ directory. These files are required for accessing the NGINX Plus repository.
shellsudo cp <downloaded-file-name>.crt /etc/ssl/nginx/nginx-repo.crt && \
sudo cp <downloaded-file-name>.key /etc/ssl/nginx/nginx-repo.key
sudo cp <downloaded-file-name>.crt /etc/ssl/nginx/nginx-repo.crt && \
sudo cp <downloaded-file-name>.key /etc/ssl/nginx/nginx-repo.key
For Alpine, the nginx-repo.crt to /etc/apk/cert.pem and nginx-repo.key files should be added to /etc/apk/cert.key. Ensure these files contain only the specific key and certificate as Alpine Linux does not support mixing client certificates for multiple repositories.
For FreeBSD, the path to these files should also be added to the /usr/local/etc/pkg.conf
file:
PKG_ENV: { SSL_NO_VERIFY_PEER: "1",
SSL_CLIENT_CERT_FILE: "/etc/ssl/nginx/nginx-repo.crt",
SSL_CLIENT_KEY_FILE: "/etc/ssl/nginx/nginx-repo.key" }
PKG_ENV: { SSL_NO_VERIFY_PEER: "1",
SSL_CLIENT_CERT_FILE: "/etc/ssl/nginx/nginx-repo.crt",
SSL_CLIENT_KEY_FILE: "/etc/ssl/nginx/nginx-repo.key" }
Ensure that all required dependencies for your operating system are installed.
For Amazon Linux 2023, AlmaLinux, CentOS, Oracle Linux, RHEL, and Rocky Linux:
shellsudo dnf update && \
sudo dnf install ca-certificates
sudo dnf update && \
sudo dnf install ca-certificates
For Debian:
shellsudo apt update && \
sudo apt install apt-transport-https \
lsb-release \
ca-certificates \
wget \
gnupg2 \
debian-archive-keyring
sudo apt update && \
sudo apt install apt-transport-https \
lsb-release \
ca-certificates \
wget \
gnupg2 \
debian-archive-keyring
For Ubuntu:
shellsudo apt update && \
sudo apt install apt-transport-https \
lsb-release \
ca-certificates \
wget \
gnupg2 \
ubuntu-keyring
sudo apt update && \
sudo apt install apt-transport-https \
lsb-release \
ca-certificates \
wget \
gnupg2 \
ubuntu-keyring
For FreeBSD:
shellsudo pkg update && \
sudo pkg install ca_root_nss
sudo pkg update && \
sudo pkg install ca_root_nss
Ensure that the NGINX signing key has been added, if required by your operating system.
For Debian:
shellwget -qO - https://cs.nginx.com/static/keys/nginx_signing.key \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
wget -qO - https://cs.nginx.com/static/keys/nginx_signing.key \
| gpg --dearmor \
| sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
For Ubuntu:
shellprintf "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
https://pkgs.nginx.com/plus/ubuntu `lsb_release -cs` nginx-plus\n" \
| sudo tee /etc/apt/sources.list.d/nginx-plus.list
printf "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
https://pkgs.nginx.com/plus/ubuntu `lsb_release -cs` nginx-plus\n" \
| sudo tee /etc/apt/sources.list.d/nginx-plus.list
For Alpine:
sudo wget -O /etc/apk/keys/nginx_signing.rsa.pub https://cs.nginx.com/static/keys/nginx_signing.rsa.pub
sudo wget -O /etc/apk/keys/nginx_signing.rsa.pub https://cs.nginx.com/static/keys/nginx_signing.rsa.pub
Ensure that your package management system is configured to pull packages from the NGINX Plus repository. See Installing NGINX Plus for details.
Update the repository information and install the nginx-plus-module-otel
package. In a terminal, run the appropriate command for your operating system.
For CentOS, Oracle Linux, and RHEL:
shellsudo yum update && \
sudo yum install nginx-plus-module-otel
sudo yum update && \
sudo yum install nginx-plus-module-otel
For Amazon Linux 2023, AlmaLinux, Rocky Linux:
shellsudo dnf update && \
sudo dnf install nginx-plus-module-otel
sudo dnf update && \
sudo dnf install nginx-plus-module-otel
For Debian and Ubuntu:
shellsudo apt update && \
sudo apt install nginx-plus-module-otel
sudo apt update && \
sudo apt install nginx-plus-module-otel
For Alpine:
shellsudo apk update && \
sudo apk add nginx-plus-module-otel
sudo apk update && \
sudo apk add nginx-plus-module-otel
For FreeBSD:
shellsudo pkg update && \
sudo pkg install nginx-plus-module-otel
sudo pkg update && \
sudo pkg install nginx-plus-module-otel
The resulting ngx_otel_module.so
dynamic module will be written to the following directory, depending on your operating system:
/usr/lib64/nginx/modules/
for most Linux distributions/usr/lib/nginx/modules
for Debian, Ubuntu, Alpine/usr/local/etc/nginx/modules
for FreeBSDEnable dynamic loading of the module.
In a text editor, open the NGINX Plus configuration file (/etc/nginx/nginx.conf
for Linux or /usr/local/etc/nginx/nginx.conf
for FreeBSD).
On the top-level (or âmain
â) context, specify the path to the dynamic module with the load_module
directive:
load_module modules/ngx_otel_module.so;
http {
#...
}
load_module modules/ngx_otel_module.so;
http {
#...
}
Test the NGINX Plus configuration. In a terminal, type-in the command:
Expected output of the command:
shellnginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf is successful
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf is successful
Reload the NGINX Plus configuration to enable the module:
In a text editor, open the NGINX Plus configuration file:
/etc/nginx/nginx.conf
for Linux/usr/local/etc/nginx/nginx.conf
for FreeBSDFor a complete list of directives, embedded variables, default span attributes, refer to the ngx_otel_module
official documentation.
List of directives:
https://nginx.org/en/docs/ngx_otel_module.html#directives
List of variables:
https://nginx.org/en/docs/ngx_otel_module.html#variables
Default span attributes:
https://nginx.org/en/docs/ngx_otel_module.html#span
This configuration enables basic request tracing, capturing tracing information for every incoming request, even in non-distributed environments.
nginxhttp {
otel_trace on;
server {
location / {
proxy_pass http://backend;
}
}
}
http {
otel_trace on;
server {
location / {
proxy_pass http://backend;
}
}
}
This configuration enables parent-based tracing, where NGINX Plus captures and propagates trace information from incoming requests, allowing tracing contexts to be inherited from the parent request. It is useful in scenarios where NGINX Plus is used as a reverse proxy within a distributed tracing system.
nginxhttp {
server {
location / {
otel_trace $otel_parent_sampled;
otel_trace_context propagate;
proxy_pass http://backend;
}
}
}
http {
server {
location / {
otel_trace $otel_parent_sampled;
otel_trace_context propagate;
proxy_pass http://backend;
}
}
}
This configuration enables sampling of a specified percentage of requests or user sessions for tracing, based on configurable ratios.
nginxhttp {
# trace 10% of requests
split_clients $otel_trace_id $ratio_sampler {
10% on;
* off;
}
# or we can trace 10% of user sessions
split_clients $cookie_sessionid $session_sampler {
10% on;
* off;
}
server {
location / {
otel_trace $ratio_sampler;
otel_trace_context inject;
proxy_pass http://backend;
}
}
}
http {
# trace 10% of requests
split_clients $otel_trace_id $ratio_sampler {
10% on;
* off;
}
# or we can trace 10% of user sessions
split_clients $cookie_sessionid $session_sampler {
10% on;
* off;
}
server {
location / {
otel_trace $ratio_sampler;
otel_trace_context inject;
proxy_pass http://backend;
}
}
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4