=encoding utf-8 =head1 NAME ngx_otel_module - Module ngx_otel_module =head1 The C module (1.23.4) provides L distributed tracing support. The module supports L context propagation and OTLPEgRPC export protocol. The source code of the module is available L. Download and install instructions are available L. The module is also available in a prebuilt C L since 1.25.3 and in C package as part of our commercial subscription. =head1 Example Configuration load_module modules/ngx_otel_module.so; events { } http { otel_exporter { endpoint localhost:4317; } server { listen 127.0.0.1:8080; location / { otel_trace on; otel_trace_context inject; proxy_pass http://backend; } } } =head1 Directives =head2 otel_exporter otel_exporter { B<...> } B I Specifies OTel data export parameters: =over =item C the address of OTLPEgRPC endpoint that will accept telemetry data. =item C the maximum interval between two exports, by default is C<5> seconds. =item C the maximum number of spans to be sent in one batch per worker, by default is C<512>. =item C the number of pending batches per worker, spans exceeding the limit are dropped, by default is C<4>. =back Example: otel_exporter { endpoint localhost:4317; interval 5s; batch_size 512; batch_count 4; } =head2 otel_service_name B otel_service_name I>> B I B I Sets the “L|https://opentelemetry.io/docs/reference/specification/resource/semantic_conventions/#service>” attribute of the OTel resource. =head2 otel_trace B otel_trace I E C E C<$variable>> B I B I B I B I Enables or disables OpenTelemetry tracing. The directive can also be enabled by specifying a variable: split_clients "$otel_trace_id" $ratio_sampler { 10% on; * off; } server { location / { otel_trace $ratio_sampler; otel_trace_context inject; proxy_pass http://backend; } } =head2 otel_trace_context B otel_trace_context I E C E C E C> B I B I B I B I Specifies how to propagate Ltracestate|https://www.w3.org/TR/trace-context/#design-overview> headers: =over =item C uses an existing trace context from the request, so that the identifiers of a trace and the parent span are inherited from the incoming request. =item C adds a new context to the request, overwriting existing headers, if any. =item C updates the existing context (combines L and L). =item C skips context headers processing. =back =head2 otel_span_name B otel_span_name I>> B I B I B I Defines the name of the OTel L. By default, it is a name of the location for a request. The name can contain variables. =head2 otel_span_attr B otel_span_attr I> I>> B I B I B I Adds a custom OTel span attribute. The value can contain variables. =head1 Default span attributes The following L are added automatically: =over =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =item * C =back =head1 Embedded Variables =over =item C<$otel_trace_id> the identifier of the trace the current span belongs to, for example, C<56552bc4daa3bf39c08362527e1dd6c4> =item C<$otel_span_id> the identifier of the current span, for example, C<4c0b8531ec38ca59> =item C<$otel_parent_id> the identifier of the parent span, for example, C =item C<$otel_parent_sampled> the “C” flag of the parent span, can be “C<1>” or “C<0>” =back