Skip to content

Commit 77ca8cf

Browse files
feedback
Signed-off-by: Adrian Cole <adrian@tetrate.io>
1 parent 50c9606 commit 77ca8cf

18 files changed

Lines changed: 53 additions & 65 deletions

File tree

api/v1alpha1/envoyproxy_tracing_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ type OpenTelemetryTracingProvider struct {
161161

162162
// OTelSamplerType specifies the sampler type.
163163
// Values correspond to the OTEL_TRACES_SAMPLER environment variable.
164-
// +kubebuilder:validation:Enum=AlwaysOn;AlwaysOff;TraceIdRatioBased;ParentBasedAlwaysOn;ParentBasedAlwaysOff;ParentBasedTraceIdRatioBased
164+
// +kubebuilder:validation:Enum=AlwaysOn;AlwaysOff;TraceIdRatio;ParentBasedAlwaysOn;ParentBasedAlwaysOff;ParentBasedTraceIdRatio
165165
type OTelSamplerType string
166166

167167
const (
@@ -170,19 +170,19 @@ const (
170170
// OTelSamplerTypeAlwaysOff drops all spans.
171171
OTelSamplerTypeAlwaysOff OTelSamplerType = "AlwaysOff"
172172
// OTelSamplerTypeTraceIDRatioBased exports a percentage of spans based on trace ID.
173-
OTelSamplerTypeTraceIDRatioBased OTelSamplerType = "TraceIdRatioBased"
173+
OTelSamplerTypeTraceIDRatioBased OTelSamplerType = "TraceIdRatio"
174174
// OTelSamplerTypeParentBasedAlwaysOn respects the parent span's sampling decision, sampling when no parent exists.
175175
OTelSamplerTypeParentBasedAlwaysOn OTelSamplerType = "ParentBasedAlwaysOn"
176176
// OTelSamplerTypeParentBasedAlwaysOff respects the parent span's sampling decision, dropping when no parent exists.
177177
OTelSamplerTypeParentBasedAlwaysOff OTelSamplerType = "ParentBasedAlwaysOff"
178178
// OTelSamplerTypeParentBasedTraceIDRatioBased respects the parent span's sampling decision, using trace ID ratio when no parent exists.
179-
OTelSamplerTypeParentBasedTraceIDRatioBased OTelSamplerType = "ParentBasedTraceIdRatioBased"
179+
OTelSamplerTypeParentBasedTraceIDRatioBased OTelSamplerType = "ParentBasedTraceIdRatio"
180180
)
181181

182182
// OTelSampler configures the OpenTelemetry sampler.
183183
// Type maps to OTEL_TRACES_SAMPLER.
184184
//
185-
// +kubebuilder:validation:XValidation:message="samplingPercentage can only be set with TraceIdRatioBased or ParentBasedTraceIdRatioBased",rule="has(self.samplingPercentage) ? (self.type == 'TraceIdRatioBased' || self.type == 'ParentBasedTraceIdRatioBased') : true"
185+
// +kubebuilder:validation:XValidation:message="samplingPercentage can only be set with TraceIdRatio or ParentBasedTraceIdRatio",rule="has(self.samplingPercentage) ? (self.type == 'TraceIdRatio' || self.type == 'ParentBasedTraceIdRatio') : true"
186186
type OTelSampler struct {
187187
// Type is the sampler type.
188188
// +kubebuilder:default=AlwaysOn

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17181,19 +17181,19 @@ spec:
1718117181
enum:
1718217182
- AlwaysOn
1718317183
- AlwaysOff
17184-
- TraceIdRatioBased
17184+
- TraceIdRatio
1718517185
- ParentBasedAlwaysOn
1718617186
- ParentBasedAlwaysOff
17187-
- ParentBasedTraceIdRatioBased
17187+
- ParentBasedTraceIdRatio
1718817188
type: string
1718917189
required:
1719017190
- type
1719117191
type: object
1719217192
x-kubernetes-validations:
1719317193
- message: samplingPercentage can only be set with
17194-
TraceIdRatioBased or ParentBasedTraceIdRatioBased
17194+
TraceIdRatio or ParentBasedTraceIdRatio
1719517195
rule: 'has(self.samplingPercentage) ? (self.type
17196-
== ''TraceIdRatioBased'' || self.type == ''ParentBasedTraceIdRatioBased'')
17196+
== ''TraceIdRatio'' || self.type == ''ParentBasedTraceIdRatio'')
1719717197
: true'
1719817198
type: object
1719917199
port:

charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17180,19 +17180,19 @@ spec:
1718017180
enum:
1718117181
- AlwaysOn
1718217182
- AlwaysOff
17183-
- TraceIdRatioBased
17183+
- TraceIdRatio
1718417184
- ParentBasedAlwaysOn
1718517185
- ParentBasedAlwaysOff
17186-
- ParentBasedTraceIdRatioBased
17186+
- ParentBasedTraceIdRatio
1718717187
type: string
1718817188
required:
1718917189
- type
1719017190
type: object
1719117191
x-kubernetes-validations:
1719217192
- message: samplingPercentage can only be set with
17193-
TraceIdRatioBased or ParentBasedTraceIdRatioBased
17193+
TraceIdRatio or ParentBasedTraceIdRatio
1719417194
rule: 'has(self.samplingPercentage) ? (self.type
17195-
== ''TraceIdRatioBased'' || self.type == ''ParentBasedTraceIdRatioBased'')
17195+
== ''TraceIdRatio'' || self.type == ''ParentBasedTraceIdRatio'')
1719617196
: true'
1719717197
type: object
1719817198
port:

internal/gatewayapi/listener.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ func (t *Translator) processTracing(gw *gwapiv1.Gateway, envoyproxy *egv1a1.Envo
791791
Traffic: traffic,
792792
Headers: getOpenTelemetryTracingHeaders(&tracing.Provider),
793793
SpanName: tracing.SpanName,
794-
Sampler: getOpenTelemetryTracingSampler(&tracing.Provider),
795794
}, nil
796795
}
797796

@@ -854,13 +853,6 @@ func getOpenTelemetryTracingHeaders(provider *egv1a1.TracingProvider) []gwapiv1.
854853
return nil
855854
}
856855

857-
func getOpenTelemetryTracingSampler(provider *egv1a1.TracingProvider) *egv1a1.OTelSampler {
858-
if provider != nil && provider.OpenTelemetry != nil {
859-
return provider.OpenTelemetry.Sampler
860-
}
861-
return nil
862-
}
863-
864856
func getOpenTelemetryTracingResourceAttributes(provider *egv1a1.TracingProvider) map[string]string {
865857
if provider != nil && provider.OpenTelemetry != nil {
866858
return provider.OpenTelemetry.ResourceAttributes

internal/gatewayapi/testdata/envoyproxy-tracing-sampler.in.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ envoyProxyForGatewayClass:
1616
type: OpenTelemetry
1717
openTelemetry:
1818
sampler:
19-
type: ParentBasedTraceIdRatioBased
19+
type: ParentBasedTraceIdRatio
2020
samplingPercentage:
2121
numerator: 50
2222
provider:

internal/gatewayapi/testdata/envoyproxy-tracing-sampler.out.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ infraIR:
6767
sampler:
6868
samplingPercentage:
6969
numerator: 50
70-
type: ParentBasedTraceIdRatioBased
70+
type: ParentBasedTraceIdRatio
7171
type: OpenTelemetry
7272
samplingRate: 100
7373
status: {}
@@ -162,11 +162,7 @@ xdsIR:
162162
sampler:
163163
samplingPercentage:
164164
numerator: 50
165-
type: ParentBasedTraceIdRatioBased
165+
type: ParentBasedTraceIdRatio
166166
type: OpenTelemetry
167-
sampler:
168-
samplingPercentage:
169-
numerator: 50
170-
type: ParentBasedTraceIdRatioBased
171167
samplingRate: 100
172168
serviceName: gateway-1.envoy-gateway

internal/ir/xds.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2718,7 +2718,6 @@ type Tracing struct {
27182718
Provider egv1a1.TracingProvider `json:"provider"`
27192719
Headers []gwapiv1.HTTPHeader `json:"headers,omitempty" yaml:"headers,omitempty"`
27202720
SpanName *egv1a1.TracingSpanName `json:"spanName,omitempty"`
2721-
Sampler *egv1a1.OTelSampler `json:"sampler,omitempty" yaml:"sampler,omitempty"`
27222721
}
27232722

27242723
// Metrics defines the configuration for metrics generated by Envoy

internal/ir/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/xds/translator/testdata/in/xds-ir/tracing-otel-sampler-always-on.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ tracing:
22
serviceName: "fake-name.fake-ns"
33
samplingRate: 100
44
authority: "otel-collector.default.svc.cluster.local"
5-
sampler:
6-
type: AlwaysOn
75
destination:
86
name: "tracing-0"
97
settings:
@@ -17,6 +15,9 @@ tracing:
1715
host: otel-collector.monitoring.svc.cluster.local
1816
port: 4317
1917
type: OpenTelemetry
18+
openTelemetry:
19+
sampler:
20+
type: AlwaysOn
2021
http:
2122
- name: "first-listener"
2223
address: "::"

internal/xds/translator/testdata/in/xds-ir/tracing-otel-sampler.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ tracing:
22
serviceName: "fake-name.fake-ns"
33
samplingRate: 100
44
authority: "otel-collector.default.svc.cluster.local"
5-
sampler:
6-
type: ParentBasedTraceIdRatioBased
7-
samplingPercentage:
8-
numerator: 0
95
destination:
106
name: "tracing-0"
117
settings:
@@ -19,6 +15,11 @@ tracing:
1915
host: otel-collector.monitoring.svc.cluster.local
2016
port: 4317
2117
type: OpenTelemetry
18+
openTelemetry:
19+
sampler:
20+
type: ParentBasedTraceIdRatio
21+
samplingPercentage:
22+
numerator: 0
2223
http:
2324
- name: "first-listener"
2425
address: "::"

0 commit comments

Comments
 (0)