You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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](https://w3c.github.io/trace-context/) trace context propagation, OpenTelemetry Protocol (OTLP)/gRPC trace exports, and offers several advantages over existing OTel modules including:
17
17
18
-
- Enhanced performance: other OTel implementations can reduce request processing by up to 50%, while `nginx-plus-module-otel` minimizes this impact to just 10-15%.
18
+
- Enhanced performance: other OTel implementations can reduce request processing by up to 50%, while the native module minimizes this impact to just 10-15%.
19
19
20
20
- Simplified provisioning through NGINX configuration file.
21
21
22
22
- Dynamic, variable-based control of trace parameters with cookies, tokens, and variables. See [Ratio-based Tracing](#example) example for details.
23
23
24
24
- Dynamic control of sampling parameters via the [NGINX Plus API]({{< ref "/nginx/admin-guide/monitoring/live-activity-monitoring.md#using-the-rest-api" >}}) and [key-value storage]({{< ref "/nginx/admin-guide/security-controls/denylisting-ip-addresses.md" >}}).
25
25
26
-
The repository can be found on [GitHub](https://github.com/nginxinc/nginx-otel). The documentation can be found on [nginx.org](https://nginx.org/en/docs/ngx_otel_module.html).
26
+
The source code for the module is available in the official [GitHub repository](https://github.com/nginxinc/nginx-otel). The official documentation, including module reference and usage examples, is available on the [nginx.org](https://nginx.org/en/docs/ngx_otel_module.html) website.
27
+
28
+
The OpenTelemetry module supersedes the deprecated [OpenTracing]({{< ref "opentracing.md" >}}) module which was available until NGINX Plus [Release 34]({{< ref "nginx/releases.md#r34" >}}).
27
29
28
30
29
31
## Installation
30
32
31
-
Similar to [NGINX Plus]({{< ref "/nginx/admin-guide/installing-nginx/installing-nginx-plus.md" >}}), prebuilt packages of the `nginx-plus-module-otel` module can can be installed directly from the official repository for different distributions. Before installation you will need to add the NGINX Plus package repositories for your distribution and update the repository metadata.
33
+
The installation process closely follows the [NGINX Plus installation procedure]({{< ref "/nginx/admin-guide/installing-nginx/installing-nginx-plus.md" >}}). Prebuilt packages of the module for various Linux distributions can can be installed directly from the official repository. Prior to installation, you need to add the NGINX Plus package repository for your distribution and update the repository metadata.
34
+
35
+
1. Check the [Technical Specifications]({{< ref "nginx/technical-specs.md" >}}) page to verify that the module is supported by your operating system.
36
+
37
+
{{< note >}} The OpenTelemetry module cannot be installed on Amazon Linux 2 LTS and SLES 15 SP5+. {{< /note >}}
38
+
39
+
2. Make sure you have the latest version of NGINX Plus. In Terminal, run the command:
40
+
41
+
```shell
42
+
nginx -v
43
+
```
44
+
45
+
Expected output of the command:
46
+
47
+
```shell
48
+
nginx version: nginx/1.27.4 (nginx-plus-r34)
49
+
```
50
+
51
+
3. Ensure you have the **nginx-repo.crt** and **nginx-repo.key** files from [MyF5 Customer Portal](https://account.f5.com/myf5) in the **/etc/ssl/nginx/** directory. These files are required for accessing the NGINX Plus repository.
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.
32
59
33
-
1. Check the [Technical Specifications]({{< ref "nginx/technical-specs.md" >}}) page to verify that the module is supported by your operating system.
60
+
For FreeBSD, the path to these files should also be added to the `/usr/local/etc/pkg.conf` file:
34
61
35
-
{{< note >}} The OpenTelemetry module cannot be installed on Amazon Linux 2 LTS and SLES 15 SP5+. {{< /note >}}
6. Ensure that your package management system is configured to pull packages from the NGINX Plus repository. See [Installing NGINX Plus]({{< ref "/nginx/admin-guide/installing-nginx/installing-nginx-plus.md">}}) for details.
92
133
93
-
```shell
94
-
sudo pkg update
95
-
sudo pkg install ca_root_nss
96
-
```
134
+
7. Update the repository information and install the package. In a terminal, run the appropriate commandfor your operating system.
97
135
98
-
3. Make sure you have obtained the **nginx-repo.crt** and **nginx-repo.key** files from MyF5 and put them to the **/etc/ssl/nginx/** directory. These files are required for accessing the NGINX Plus repository:
136
+
For CentOS, Oracle Linux, and RHEL:
99
137
100
-
```shell
101
-
sudo cp nginx-repo.crt /etc/ssl/nginx/
102
-
sudo cp nginx-repo.key /etc/ssl/nginx/
103
-
```
138
+
```shell
139
+
sudo yum update && \
140
+
sudo yum install nginx-plus-module-otel
141
+
```
104
142
105
-
For Alpine, upload **nginx-repo.crt** to **/etc/apk/cert.pem** and **nginx-repo.key** 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.
143
+
For Amazon Linux 2023, AlmaLinux, Rocky Linux:
106
144
107
-
4. Make sure your package management system is configured to pull from the NGINX Plus repository. See [Installing NGINX Plus]({{< ref "/nginx/admin-guide/installing-nginx/installing-nginx-plus.md" >}}) for details.
145
+
```shell
146
+
sudo dnf update && \
147
+
sudo dnf install nginx-plus-module-otel
148
+
```
108
149
109
-
4. Update the repository information and install the package. In a terminal, run the appropriate command for your operating system.
150
+
For Debian and Ubuntu:
110
151
111
-
For CentOS, Oracle Linux, and RHEL:
152
+
```shell
153
+
sudo apt update && \
154
+
sudo apt install nginx-plus-module-otel
155
+
```
112
156
113
-
```shell
114
-
sudo yum update
115
-
sudo yum install nginx-plus-module-otel
116
-
```
157
+
For Alpine:
117
158
118
-
For Amazon Linux 2023, AlmaLinux, Rocky Linux:
159
+
```shell
160
+
sudo apk update && \
161
+
sudo apk add nginx-plus-module-otel
162
+
```
119
163
120
-
```shell
121
-
sudo dnf update
122
-
sudo dnf install nginx-plus-module-otel
123
-
```
164
+
For FreeBSD:
124
165
125
-
For Debian and Ubuntu:
166
+
```shell
167
+
sudo pkg update && \
168
+
sudo pkg install nginx-plus-module-otel
169
+
```
126
170
127
-
```shell
128
-
sudo apt update
129
-
sudo apt install nginx-plus-module-otel
130
-
```
171
+
The resulting `ngx_otel_module.so` dynamic module will be written to the following directory, depending on your operating system:
131
172
132
-
For Alpine:
173
+
- `/usr/local/nginx/modules`for most Linux Distributions
174
+
- `/usr/lib/nginx/modules`for Ubuntu
175
+
- `/usr/local/etc/nginx/modules`for FreeBSD
133
176
134
-
```shell
135
-
sudo apk update
136
-
sudo apk add nginx-plus-module-otel
137
-
```
177
+
8. Enable dynamic loading of the module.
138
178
139
-
For FreeBSD:
179
+
- In a text editor, open the NGINX Plus configuration file (`/etc/nginx/nginx.conf`for Linux or `/usr/local/etc/nginx/nginx.conf`forFreeBSD).
140
180
141
-
```shell
142
-
sudo pkg update
143
-
sudo pkg install nginx-plus-module-otel
144
-
```
181
+
- On the top-level (or “`main`”) context, specify the path to the dynamic module with the [`load_module`](https://nginx.org/en/docs/ngx_core_module.html#load_module) directive:
145
182
146
-
The module will be installed in the `/usr/local/nginx` directory.
183
+
```nginx
184
+
load_module modules/ngx_otel_module.so;
147
185
148
-
6. Copy the `ngx_otel_module.so` dynamic module binary to `/usr/local/nginx/modules`.
186
+
http {
187
+
#...
188
+
}
189
+
```
190
+
- Save the configuration file.
149
191
150
-
7. Enable dynamic loading of the module. Open the NGINX Plus configuration file, `nginx.conf` in a text editor, and specify the [`load_module`](https://nginx.org/en/docs/ngx_core_module.html#load_module) directive on the top-level (“`main`”) context:
192
+
9. Test the NGINX Plus configuration. In a terminal, type-in the command:
151
193
152
-
```nginx
153
-
load_module modules/ngx_otel_module.so;
194
+
```shell
195
+
nginx -t
196
+
```
154
197
155
-
http {
156
-
#...
157
-
}
158
-
```
198
+
Expected output of the command:
159
199
160
-
3. Save the configuration file.
200
+
```shell
201
+
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
202
+
nginx: configuration file /etc/nginx/nginx.conf is successful
203
+
```
161
204
162
-
4. Test and reload NGINX Plus configuration to enable the module. In Terminal, type-in the command:
205
+
10. Reload the NGINX Plus configuration to enable the module:
163
206
164
-
```shell
165
-
nginx -t && nginx -s reload
166
-
```
207
+
```shell
208
+
nginx -s reload
209
+
```
167
210
168
211
169
212
## Configuration
170
213
214
+
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).
215
+
171
216
For a complete list of directives, embedded variables, default span attributes, refer to the `ngx_otel_module` official documentation.
172
217
173
218
List of directives:
@@ -187,7 +232,7 @@ Default span attributes:
187
232
188
233
### Simple Tracing
189
234
190
-
Dumping all the requests could be useful even in non-distributed environment.
235
+
This configuration enables basic request tracing, capturing tracing information forevery incoming request, evenin non-distributed environments.
191
236
192
237
```nginx
193
238
http {
@@ -202,6 +247,8 @@ http {
202
247
203
248
### Parent-based Tracing
204
249
250
+
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.
251
+
205
252
```nginx
206
253
http {
207
254
server {
@@ -217,6 +264,8 @@ http {
217
264
218
265
### Ratio-based Tracing
219
266
267
+
This configuration enables sampling of a specified percentage of requests or user sessions for tracing, based on configurable ratios.
268
+
220
269
```nginx
221
270
http {
222
271
# trace 10% of requests
@@ -248,6 +297,8 @@ http {
248
297
249
298
- [Official Documentation for the NGINX Native OpenTelemetry Module](https://nginx.org/en/docs/ngx_otel_module.html)
250
299
300
+
- [NGINX Plus Technical Specifications]({{< ref "nginx/technical-specs.md">}})
0 commit comments