-
Notifications
You must be signed in to change notification settings - Fork 175
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
Allow non-integral X-Ray sampling rates #803
Conversation
👀 Heads Up
|
re-r? @stripe/observability |
@@ -80,7 +80,7 @@ type XRaySpanSink struct { | |||
var _ sinks.SpanSink = &XRaySpanSink{} | |||
|
|||
// NewXRaySpanSink creates a new instance of a XRaySpanSink. | |||
func NewXRaySpanSink(daemonAddr string, sampleRatePercentage int, commonTags map[string]string, annotationTags []string, log *logrus.Logger) (*XRaySpanSink, error) { | |||
func NewXRaySpanSink(daemonAddr string, sampleRatePercentage float64, commonTags map[string]string, annotationTags []string, log *logrus.Logger) (*XRaySpanSink, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this irritate the math.MaxUint32
below? (otherwise, it looks pretty simple)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually doesn't! (it compiles, and I even test-logged the sample value).
If you're curious why it works: despite the semantic significance, math.MaxUint32 is actually defined as an untyped constant (MaxUint8 = 1<<8 - 1
), so to the compiler, it's the same as multiplying a float64 by a hard-coded, untyped numeric literal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my suspicion, excellent!
Summary
Allow non-integer values to be set for X-Ray sampling rates. Notably, this allows users to set rates below 1% (without disabling X-Ray entirely).
Motivation
Test plan
Rollout/monitoring/revert plan
r? @stripe/observability