How does one use a custom sampler? #1407
-
Hi, I am aware of the built-in samplers:
But I'd like to understand how to use a custom sampler? I currently have the following:
But these lines of code don't seem to be taking effect. Any guidance? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Hi @davidji99 - what you posted looks about correct, so I'm not immediately sure what the issue is. Could you give me a more substantial reproduction case, so I can dig into it a little more? Specifically I think having a snippet of code that shows the full SDK initialization you're doing along with how you're generating a trace that doesn't seem to respect your sampler - that would help a lot. |
Beta Was this translation helpful? Give feedback.
-
Thanks @ahayworth. Let me get back with more details. |
Beta Was this translation helpful? Give feedback.
-
Hey @davidji99 are you still stuck on this? I know we're using the attribute writer successfully to configure custom samplers on various applications in our org. OpenTelemetry.tracer_provider.sampler = CustomSampler.new(sampling_probability) |
Beta Was this translation helpful? Give feedback.
-
Thanks @robertlaurin. Appreciate the sample code. |
Beta Was this translation helpful? Give feedback.
-
@davidji99 are we ok to close this issue now? |
Beta Was this translation helpful? Give feedback.
-
@robertlaurin I am going to convert this to a discussion and mark your response as the answer. |
Beta Was this translation helpful? Give feedback.
Hey @davidji99 are you still stuck on this?
I know we're using the attribute writer successfully to configure custom samplers on various applications in our org.