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

Switch default OTel sampler to TraceIdRatioBased #12450

Open
wants to merge 1 commit 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
31 changes: 22 additions & 9 deletions docs/user-guide/nginx-configuration/configmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ The following table shows a configuration option's name, type, and the default v
| [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-max-queuesize](#otel-max-queuesize) | int | 2048 | |
| [otel-schedule-delay-millis](#otel-schedule-delay-millis) | int | 5000 | |
| [otel-max-export-batch-size](#otel-max-export-batch-size) | int | 512 | |
| [otel-service-name](#otel-service-name) | string | "nginx" | |
| [otel-sampler](#otel-sampler) | string | "AlwaysOff" | |
| [otel-sampler-parent-based](#otel-sampler-parent-based) | bool | "false" | |
| [otel-sampler](#otel-sampler) | string | "TraceIdRatioBased" | |
| [otel-sampler-parent-based](#otel-sampler-parent-based) | bool | "true" | |
| [otel-sampler-ratio](#otel-sampler-ratio) | float | 0.01 | |
| [main-snippet](#main-snippet) | string | "" | |
| [http-snippet](#http-snippet) | string | "" | |
Expand Down Expand Up @@ -1034,20 +1034,33 @@ 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-queuesize

The maximum queue size. After the size is reached data are dropped. _**default:**_ 2048

## otel-schedule-delay-millis

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

## otel-max-export-batch-size

The maximum batch size of every export. It must be smaller or equal to [otel-max-queuesize](#otel-max-queuesize). _**default:**_ 512

## otel-sampler-parent-based

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

## otel-sampler-ratio

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. _**default:**_ TraceIdRatioBased

## main-snippet

Expand Down
19 changes: 8 additions & 11 deletions docs/user-guide/third-party-addons/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,23 @@ otlp-collector-port
# specifies the service name to use for any traces created, Default: nginx
otel-service-name

# The maximum queue size. After the size is reached data are dropped.
# The maximum queue size. After the size is reached data are dropped, Default: 2048
otel-max-queuesize

# The delay interval in milliseconds between two consecutive exports.
# The delay interval in milliseconds between two consecutive exports, Default: 5000
otel-schedule-delay-millis

# How long the export can run before it is cancelled.
otel-schedule-delay-millis

# The maximum batch size of every export. It must be smaller or equal to maxQueueSize.
# The maximum batch size of every export. It must be smaller or equal to otel-max-queuesize, Default: 512
otel-max-export-batch-size

# specifies sample rate for any traces created, Default: 0.01
otel-sampler-ratio

# specifies the sampler to be used when sampling traces.
# The available samplers are: AlwaysOn, AlwaysOff, TraceIdRatioBased, Default: AlwaysOff
# The available samplers are: AlwaysOn, AlwaysOff, TraceIdRatioBased, Default: TraceIdRatioBased
otel-sampler

# Uses sampler implementation which by default will take a sample if parent Activity is sampled, Default: false
# Uses sampler implementation which by default will take a sample if parent Activity is sampled, Default: true
otel-sampler-parent-based
```

Expand Down Expand Up @@ -164,9 +161,9 @@ To install the example and collectors run:
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-parent-based: "false"
otel-sampler: "TraceIdRatioBased" # Also: AlwaysOn, AlwaysOff
otel-sampler-ratio: "0.01"
otel-sampler-parent-based: "true"
metadata:
name: ingress-nginx-controller
namespace: ingress-nginx
Expand Down
10 changes: 5 additions & 5 deletions internal/ingress/controller/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ type Configuration struct {
OtelServiceName string `json:"otel-service-name"`

// OtelSampler specifies the sampler to use for any traces created
// Default: AlwaysOn
// Default: TraceIdRatioBased
OtelSampler string `json:"otel-sampler"`

// OtelSamplerRatio specifies the sampler ratio to use for any traces created
Expand All @@ -620,15 +620,15 @@ type Configuration struct {
// Default: true
OtelSamplerParentBased bool `json:"otel-sampler-parent-based"`

// MaxQueueSize specifies the max queue size for uploading traces
// OtelMaxQueueSize specifies the max queue size for uploading traces
// Default: 2048
OtelMaxQueueSize int32 `json:"otel-max-queuesize"`

// ScheduleDelayMillis specifies the max delay between uploading traces
// OtelScheduleDelayMillis specifies the max delay between uploading traces
// Default: 5000
OtelScheduleDelayMillis int32 `json:"otel-schedule-delay-millis"`

// MaxExportBatchSize specifies the max export batch size to used when uploading traces
// OtelMaxExportBatchSize specifies the max export batch size to used when uploading traces
// Default: 512
OtelMaxExportBatchSize int32 `json:"otel-max-export-batch-size"`

Expand Down Expand Up @@ -886,7 +886,7 @@ func NewDefault() Configuration {
OpentelemetryConfig: "/etc/ingress-controller/telemetry/opentelemetry.toml",
OtlpCollectorPort: "4317",
OtelServiceName: "nginx",
OtelSampler: "AlwaysOn",
OtelSampler: "TraceIdRatioBased",
OtelSamplerRatio: 0.01,
OtelSamplerParentBased: true,
OtelScheduleDelayMillis: 5000,
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 @@ -1063,7 +1063,7 @@ max_export_batch_size = {{ .OtelMaxExportBatchSize }}
name = "{{ .OtelServiceName }}" # Opentelemetry resource name

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