Repository navigation
Closed
Description
Description:
Traces are not being sent out when using 100:100 samplingFraction, but are when using 100% samplingRate. Neither working when setting 50:100.
Repro steps:
Set EnvoyProxy object to nominator 100 and denominator 100:
YAML config of EnvoyProxy
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
labels:
argocd.argoproj.io/instance: envoy-gateway
name: private
namespace: envoy-gateway
spec:
logging:
level:
default: info
provider:
kubernetes:
envoyDeployment:
container:
image: ...envoyproxy/envoy:v1.34.2
resources:
limits:
cpu: 500m
memory: 200Mi
requests:
cpu: 500m
memory: 200Mi
name: envoy-private
pod:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app.kubernetes.io/instance: envoy-private
topologyKey: kubernetes.io/hostname
labels:
app.kubernetes.io/instance: envoy-private
topologySpreadConstraints:
- labelSelector:
matchLabels:
app.kubernetes.io/instance: envoy-private
maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 1
type: RollingUpdate
envoyHpa:
maxReplicas: 20
metrics:
- resource:
name: cpu
target:
averageUtilization: 60
type: Utilization
type: Resource
- resource:
name: memory
target:
averageUtilization: 60
type: Utilization
type: Resource
minReplicas: 3
envoyPDB:
maxUnavailable: 1
envoyService:
externalTrafficPolicy: Local
name: envoy-private
type: ClusterIP
type: Kubernetes
telemetry:
tracing:
customTags:
envoy:
literal:
value: private
type: Literal
k8s.namespace.name:
environment:
defaultValue: envoy-gateway
name: ENVOY_GATEWAY_NAMESPACE
type: Environment
k8s.pod.name:
environment:
defaultValue: '-'
name: ENVOY_POD_NAME
type: Environment
provider:
literal:
value: otel
type: Literal
provider:
host: alloy.alloy.svc
port: 4317
type: OpenTelemetry
samplingFraction:
denominator: 100
numerator: 100Environment:
Envoy: 1.34.2
Envoy Gateway: 1.6.3
Alloy: 1.12.2
Kubernetes: 1.33.7
CRDS envoy: 1.6.3
CRDS gateway: 1.4.1 bundle
Logs:
N/A
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working
Activity
arkodg commentedon Feb 16, 2026
cc @zirain
zirain commentedon Feb 17, 2026
we introuduce this for users who want sample rate less than 1%.
IIUC, if you want
100%, it should be as following:fe-ax commentedon Feb 17, 2026
@zirain I'm sorry that I wasn't clear. The goal is to set it to 1:1000 or 1:10000, but it didn't sent any traces in using fractional sampling. Setting it to 1:10 or 1:1 neither did, which I suspected would send 100% for testing purposes.
Using samplingRate: 1 works. (Or 100)
zirain commentedon Feb 18, 2026
100:1 means 100% sample rateing.
1:1000 means 1 in 1000 requests will be sampled
fe-ax commentedon Feb 18, 2026
@zirain I'm not sure whether you just want to be rude. It's not working.
That config is not functioning it seems. Even if I send thousands of requests. As mentioned it works correctly when using samplingRate.
zirain commentedon Feb 18, 2026
what's your configuration result 1% sampling rate.
fe-ax commentedon Feb 18, 2026
@zirain
That's
samplingRate: 1as mentioned above before. To get 0.1% sampling rate (which does not work, and also mentioned above):EnvoyProxy object
zirain commentedon Feb 19, 2026
result
0.001sample rate as expected.fe-ax commentedon Feb 19, 2026
@zirain Theoretically, yes, it should work. I have no doubts the setting changes the config. However when it's 0.001 it just stops sending any traces in. Or is there something else wrong in these three sampling settings?
fe-ax commentedon Feb 19, 2026
I see now.
Results in 0.001 requests being sampled from a base value of 100. Resulting in 1:100.000 being sampled.
I think there is a miscalculation going on in this setting as the documentation says 0.1% will be sampled, while in practice 0.001% will be sampled. (Referring to https://gateway.envoyproxy.io/latest/tasks/observability/proxy-trace/#sampling-rate)
fe-ax commentedon Feb 20, 2026
@zirain I've looked into it a little deeper and I think there is issue in this code.
gateway/internal/gatewayapi/listener_test.go
Lines 55 to 65 in f741159
As you said:
It would actually end up in 1% sampling as the base value for 100% is
100.0, not1.0.I think this line is missing a multiplication by 100.
gateway/internal/gatewayapi/listener.go
Line 811 in f741159
I understand that, if you agree it's indeed not as expected, changing this code is complicated. People already using this would start receiving 100 times more traces.
Maybe we should edit the documentation, like the part referred to in the comment above this one?
zirain commentedon Feb 21, 2026
@fe-ax yeah, you're right, this's my mistake.
zirain commentedon Feb 21, 2026
I missed
// +kubebuilder:validation:XValidation:message="numerator must be less than or equal to denominator",rule="self.numerator <= self.denominator"fe-ax commentedon Feb 22, 2026
Thanks!