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

docs: update otel documentation #10912

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions docs/user-guide/nginx-configuration/configmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ The following table shows a configuration option's name, type, and the default v
|[enable-opentelemetry](#enable-opentelemetry)|bool|"false"||
|[opentelemetry-trust-incoming-span](#opentelemetry-trust-incoming-span)|bool|"true"||
|[opentelemetry-operation-name](#opentelemetry-operation-name)|string|""||
|[opentelemetry-config](#/etc/ingress-controller/telemetry/opentelemetry.toml)|string|"/etc/ingress-controller/telemetry/opentelemetry.toml"||
|[opentelemetry-config](#/etc/nginx/opentelemetry.toml)|string|"/etc/nginx/opentelemetry.toml"||
|[otlp-collector-host](#otlp-collector-host)|string|""||
|[otlp-collector-port](#otlp-collector-port)|int|4317||
|[otel-max-queuesize](#otel-max-queuesize)|int|||
|[otel-schedule-delay-millis](#otel-schedule-delay-millis)|int|||
|[otel-max-export-batch-size](#otel-max-export-batch-size)|int|||
|[otel-service-name](#otel-service-name)|string|"nginx"||
|[otel-sampler](#otel-sampler)|string|"AlwaysOff"||
|[otel-max-export-batch-size](#otel-max-export-batch-size)|int|512||
|[otel-max-queuesize](#otel-max-queuesize)|int|2048||
|[otel-sampler-parent-based](#otel-sampler-parent-based)|bool|"false"||
|[otel-sampler-ratio](#otel-sampler-ratio)|float|0.01||
|[otel-sampler](#otel-sampler)|string|"AlwaysOn"||
|[otel-schedule-delay-millis](#otel-schedule-delay-millis)|int|5000||
|[otel-service-name](#otel-service-name)|string|"nginx"||
|[main-snippet](#main-snippet)|string|""||
|[http-snippet](#http-snippet)|string|""||
|[server-snippet](#server-snippet)|string|""||
Expand Down Expand Up @@ -1089,10 +1089,24 @@ Specifies the port to use when uploading traces. _**default:**_ 4317

Specifies the service name to use for any traces created. _**default:**_ nginx

## opentelemetry-trust-incoming-span: "true"
## opentelemetry-trust-incoming-span:

Enables or disables using spans from incoming requests as parent for created ones. _**default:**_ true

## otel-sampler-parent-based
## otel-max-export-batch-size

The maximum number of spans in a single batch.
(#otel-max-export-batch-size). _**default:**_ 512

## otel-schedule-delay-millis

The interval, in milliseconds, between two consecutive exports. _**default:**_ 5000

## otel-max-queuesize

The maximum queue size. _**default:**_ 2048

## otel-sampler-parent-based

Uses sampler implementation which by default will take a sample if parent Activity is sampled. _**default:**_ false

Expand All @@ -1102,7 +1116,9 @@ Specifies sample rate for any traces created. _**default:**_ 0.01

## otel-sampler

Specifies the sampler to be used when sampling traces. The available samplers are: AlwaysOff, AlwaysOn, TraceIdRatioBased, remote. _**default:**_ AlwaysOff
Specifies the sampler to be used when sampling traces. The available samplers are: AlwaysOff, AlwaysOn, TraceIdRatioBased, remote. _**default:**_ AlwaysOn

"AlwaysOn" is equivalent to setting [otel-sampler-ratio](#otel-sampler-ratio) to "1" and otel-sampler to "TraceIdRatioBased".

## main-snippet

Expand Down
13 changes: 2 additions & 11 deletions docs/user-guide/third-party-addons/opentelemetry.md

Choose a reason for hiding this comment

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

Related issue: #10966
As mentioned by @kalingaru48 on #10966 (comment) this file should document that once enabled opentelemetry is active for all traffic going through this nginx.

Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ To install the example and collectors run:
```yaml
opentelemetry:
enabled: true
image: registry.k8s.io/ingress-nginx/opentelemetry:v20230527@sha256:fd7ec835f31b7b37187238eb4fdad4438806e69f413a203796263131f4f02ed0
containerSecurityContext:
allowPrivilegeEscalation: false
```

2. Enable OpenTelemetry and set the otlp-collector-host:
Expand All @@ -165,17 +162,11 @@ To install the example and collectors run:
kind: ConfigMap
data:
enable-opentelemetry: "true"
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather keep the sample configmap as it is. It would make sense those who visit this page, also know about the options before going through the configs on the other pages.

opentelemetry-config: "/etc/ingress-controller/telemetry/opentelemetry.toml"
opentelemetry-operation-name: "HTTP $request_method $service_name $uri"
opentelemetry-trust-incoming-span: "true"
otlp-collector-host: "otel-coll-collector.otel.svc"
otlp-collector-port: "4317"
otel-max-queuesize: "2048"
otel-schedule-delay-millis: "5000"
otel-max-export-batch-size: "512"
otel-service-name: "nginx-proxy" # Opentelemetry resource name
otel-sampler: "AlwaysOn" # Also: AlwaysOff, TraceIdRatioBased
otel-sampler-ratio: "1.0"
otel-sampler: "TraceIdRatioBased" # Also: AlwaysOff, TraceIdRatioBased.
otel-sampler-ratio: "0.5"
otel-sampler-parent-based: "false"
metadata:
name: ingress-nginx-controller
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ func NewDefault() Configuration {
BindAddressIpv4: defBindAddress,
BindAddressIpv6: defBindAddress,
OpentelemetryTrustIncomingSpan: true,
OpentelemetryConfig: "/etc/ingress-controller/telemetry/opentelemetry.toml",
OpentelemetryConfig: "/etc/nginx/opentelemetry.toml",
OtlpCollectorPort: "4317",
OtelServiceName: "nginx",
OtelSampler: "AlwaysOn",
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ max_export_batch_size = {{ .OtelMaxExportBatchSize }}
name = "{{ .OtelServiceName }}" # Opentelemetry resource name

[sampler]
name = "{{ .OtelSampler }}" # Also: AlwaysOff, TraceIdRatioBased
name = "{{ .OtelSampler }}" # Also: AlwaysOn, AlwaysOff, TraceIdRatioBased
ratio = {{ .OtelSamplerRatio }}
parent_based = {{ .OtelSamplerParentBased }}
`
Expand Down