Skip to content

Commit 9f285d0

Browse files
committed
Add default links; validation
1 parent cbf449d commit 9f285d0

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

apis/v1alpha1/nginxproxy_types.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,39 @@ type Telemetry struct {
5353
//
5454
// +optional
5555
// +kubebuilder:validation:MaxProperties=64
56-
SpanAttributes map[string]string `json:"spanAttributes,omitempty"`
56+
SpanAttributes map[string]AttributeValue `json:"spanAttributes,omitempty"`
5757
}
5858

5959
// TelemetryExporter specifies OpenTelemetry export parameters.
6060
type TelemetryExporter struct {
61-
// Interval is the maximum interval between two exports, by default is 5 seconds.
61+
// Interval is the maximum interval between two exports.
62+
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
6263
//
6364
// +optional
6465
Interval *Duration `json:"interval,omitempty"`
6566

66-
// BatchSize is the maximum number of spans to be sent in one batch per worker, by default is 512.
67+
// BatchSize is the maximum number of spans to be sent in one batch per worker.
68+
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
6769
//
6870
// +optional
6971
// +kubebuilder:validation:Minimum=0
7072
BatchSize *int32 `json:"batchSize,omitempty"`
7173

72-
// BatchCount is the number of pending batches per worker, spans exceeding the limit are dropped,
73-
// by default is 4.
74+
// BatchCount is the number of pending batches per worker, spans exceeding the limit are dropped.
75+
// Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
7476
//
7577
// +optional
7678
// +kubebuilder:validation:Minimum=0
7779
BatchCount *int32 `json:"batchCount,omitempty"`
7880

7981
// Endpoint is the address of OTLP/gRPC endpoint that will accept telemetry data.
82+
//
83+
//nolint:lll
84+
// +kubebuilder:validation:Pattern=`^(?:http?:\/\/)?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*(?::\d{1,5})?$`
8085
Endpoint string `json:"endpoint"`
8186
}
87+
88+
// AttributeValue is a value paired with a key and attached to a tracing span.
89+
//
90+
// +kubebuilder:validation:MaxLength=255
91+
type AttributeValue string

apis/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gateway.nginx.org_nginxproxies.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,27 @@ spec:
5555
properties:
5656
batchCount:
5757
description: |-
58-
BatchCount is the number of pending batches per worker, spans exceeding the limit are dropped,
59-
by default is 4.
58+
BatchCount is the number of pending batches per worker, spans exceeding the limit are dropped.
59+
Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
6060
format: int32
6161
minimum: 0
6262
type: integer
6363
batchSize:
64-
description: BatchSize is the maximum number of spans to be
65-
sent in one batch per worker, by default is 512.
64+
description: |-
65+
BatchSize is the maximum number of spans to be sent in one batch per worker.
66+
Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
6667
format: int32
6768
minimum: 0
6869
type: integer
6970
endpoint:
7071
description: Endpoint is the address of OTLP/gRPC endpoint
7172
that will accept telemetry data.
73+
pattern: ^(?:http?:\/\/)?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*(?::\d{1,5})?$
7274
type: string
7375
interval:
74-
description: Interval is the maximum interval between two
75-
exports, by default is 5 seconds.
76+
description: |-
77+
Interval is the maximum interval between two exports.
78+
Default: https://nginx.org/en/docs/ngx_otel_module.html#otel_exporter
7679
pattern: ^\d{1,4}(ms|s)?$
7780
type: string
7881
required:
@@ -87,6 +90,9 @@ spec:
8790
type: string
8891
spanAttributes:
8992
additionalProperties:
93+
description: AttributeValue is a value paired with a key and
94+
attached to a tracing span.
95+
maxLength: 255
9096
type: string
9197
description: SpanAttributes are custom key/value attributes that
9298
are added to each span.

0 commit comments

Comments
 (0)