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 module provides [OpenTelemetry](https://opentelemetry.io/)distributed tracing support. The module supports [W3C](https://w3c.github.io/trace-context/) context propagation and OTLP/gRPC export protocol.
14
+
[OpenTelemetry](https://opentelemetry.io/)(OTel) is an observability framework for monitoring, tracing, troubleshooting, and optimizing applications. OTel enables the collection of telemetry data from a deployed application stack.
16
15
17
-
{{< note >}} the code of NGINX OpenTelemetry module is open source since [NGINX Open Source](https://nginx.org) 1.25.2 and NGINX Plus [Release 30]({{< ref "nginx/releases.md#r30" >}}). The source code is available on [GitHub](https://github.com/nginxinc/nginx-otel).{{< /note >}}
16
+
The `nginx-plus-module-otel` module is 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:
18
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%.
19
19
20
-
<spanid="install"></span>
21
-
## Installation
20
+
- Simplified provisioning through NGINX configuration file.
21
+
22
+
- Dynamic, variable-based control of trace parameters with cookies, tokens, and variables. See [Ratio-based Tracing](#example) example for details.
23
+
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
+
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).
27
+
28
+
29
+
## Installation {#install}
30
+
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 NGINX Plus package repositories for your distribution and update the repository metadata.
22
32
23
33
1. Check the [Technical Specifications]({{< ref "nginx/technical-specs.md" >}}) page to verify that the module is supported by your operating system.
24
34
25
-
2. Install the OpenTelemetry module package `nginx-plus-module-otel`.
35
+
{{< note >}} The OpenTelemetry module cannot be installed on Amazon Linux 2 LTS and SLES 15 SP5+. {{< /note >}}
26
36
27
-
For CentOS, Oracle Linux, and RHEL:
37
+
2. Make sure you have the latest version of NGINX Plus or you have upgraded NGINX Plus to the latest version. In Terminal, run the command:
28
38
29
39
```shell
30
-
yum install nginx-plus-module-otel
40
+
nginx -v
31
41
```
32
42
33
-
For Amazon Linux 2023, AlmaLinux, Rocky Linux:
43
+
Expected output of the command:
34
44
35
45
```shell
36
-
dnf install nginx-plus-module-otel
46
+
nginx version: nginx/1.27.4 (nginx-plus-r34)
37
47
```
38
48
39
-
For Debian and Ubuntu:
49
+
3. Make sure you have installed dependencies required for your operating system.
50
+
51
+
For Amazon Linux 2023, AlmaLinux, CentOS, Oracle Linux, RHEL, and Rocky Linux:
40
52
41
53
```shell
42
-
apt-get install nginx-plus-module-otel
54
+
sudo dnf update
55
+
sudo dnf install ca-certificates
56
+
sudo dnf update-ca-certificates #use if ca-certificates are installed
{{< note >}} the OpenTelemetry module cannot be installed on RHEL/Oracle Linux/AlmaLinux/Rocky Linux 7, Ubuntu 18.04, and Amazon Linux 2. {{< /note >}}
64
-
65
-
66
-
<spanid="configure"></span>
67
-
68
-
## Configuration
69
-
70
-
After installation you will need to enable and configure the module in NGINX Plus configuration file `nginx.conf`.
71
-
72
-
1. Enable dynamic loading of the module with the [`load_module`](https://nginx.org/en/docs/ngx_core_module.html#load_module) directive specified in the top-level (“`main`”) context:
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:
138
99
139
-
Enables or disables OpenTelemetry tracing. The directive can also be enabled by specifying a variable.
100
+
```shell
101
+
sudo cp nginx-repo.crt /etc/ssl/nginx/
102
+
sudo cp nginx-repo.key /etc/ssl/nginx/
103
+
```
140
104
141
-
**Example:**
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.
142
106
143
-
```nginx
144
-
split_clients "$otel_trace_id" $ratio_sampler {
145
-
10% on;
146
-
* off;
147
-
}
107
+
4. Make sure your package management system is configured to pull from NGINX Plus repository. See [Installing NGINX Plus]({{< ref "/nginx/admin-guide/installing-nginx/installing-nginx-plus.md" >}}) for details.
148
108
149
-
server {
150
-
location / {
151
-
otel_trace $ratio_sampler;
152
-
otel_trace_context inject;
153
-
proxy_pass http://backend;
154
-
}
155
-
}
156
-
```
109
+
4. Update the repository information and install the package. In Terminal, run the appropriate command for your operating system.
Specifies how to propagate [traceparent/tracestate](https://www.w3.org/TR/trace-context/#design-overview) headers:
127
+
```shell
128
+
sudo apt update
129
+
sudo apt install nginx-plus-module-otel
130
+
```
170
131
171
-
-`extract`— uses an existing trace context from the request, so that the identifiers of a [trace](#var_otel_trace_id) and the [parent span](#var_otel_parent_id) are inherited from the incoming request.
172
-
-`inject`— adds a new context to the request, overwriting existing headers, if any.
173
-
-`propagate`— updates the existing context (combines `extract` and `inject`).
6. Copy the `ngx_otel_module.so` dynamic module binary to `/usr/local/nginx/modules`.
187
149
188
-
Defines the name of the OTel [span](https://opentelemetry.io/docs/concepts/observability-primer/#spans). By default, it is a name of the location for a request. The name can contain variables.
189
-
<br>
190
-
<br>
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:
4. Test and reload NGINX Plus configuration to enable the module. In Terminal, type-in the command:
200
163
201
-
Adds a custom OTel span attribute. The value can contain variables.
202
-
<br>
164
+
```shell
165
+
nginx -t && nginx -s reload
166
+
```
203
167
204
168
205
-
<spanid="span_attributes"></span>
206
-
## Default span attributes
169
+
## Configuration {#configure}
207
170
208
-
The following [span attributes](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md) are added automatically:
171
+
For a complete list of directives, embedded variables, default span attributes, refer to the `ngx_otel_module` official documentation.
0 commit comments