-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(samplers): add deterministic sampler #33
base: main
Are you sure you want to change the base?
Conversation
val context = Context.root() | ||
|
||
val sampler = HoneycombDeterministicSampler(args.rate) | ||
val result = sampler.shouldSample(context, traceId, "test", SpanKind.CLIENT, Attributes.empty(), emptyList<LinkData>().toMutableList()) |
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.
UNLIKE the Swift PR, here we JUST need a Context
instead of a SpanContext
. This seems to be a difference in the OTel APIs: the Swift one has a signature:
func shouldSample(
parentContext: SpanContext?,
traceId: TraceId,
name: String,
kind: SpanKind,
attributes: [String: AttributeValue],
parentLinks: [SpanData.Link]
) -> any Decision
whereas the Android one has the signature
fun shouldSample(
context: Context,
traceId: String,
name: String,
spanKind: SpanKind,
attributes: Attributes,
parentLinks: MutableList<LinkData>
): SamplingResult
and there doesn't seem to be a relationship between Context
and SpanContext
in the Android SDK.
// private class HoneycombDecision(val decision: SamplingDecision, val attributes: Attributes) : SamplingResult { | ||
// override fun getDecision(): SamplingDecision { | ||
// return decision | ||
// } | ||
// | ||
// override fun getAttributes(): Attributes { | ||
// return attributes | ||
// } | ||
// } |
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.
maybe remove this
ee4dac2
to
bf614cc
Compare
Short description of the changes
Adds a deterministic sampler, similar to other Honeycomb distro. Heavily based on honeycombio/honeycomb-opentelemetry-swift#17
That PR never actually used the Sampler; I'm not sure if we need to make changes to HoneycombOptions / somewhere else in the initialization process to actually make use of this.
How to verify that this has the expected result