You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "tsonglew (via GitHub)" <gi...@apache.org> on 2024/05/02 12:52:01 UTC

Re: [I] [Feature] provides sample option in python agent [skywalking]

tsonglew commented on issue #12155:
URL: https://github.com/apache/skywalking/issues/12155#issuecomment-2090428396

   @CodePrometheus  I will achieve the function through following tasks:
   
   1. Add SW_AGENT_SAMPLE in skywalking/config.py
   2. Create a `sampling_service` with `try_sampling`, `reset_sampling_factor` and other methods. `try_sampling` will add one to a counter property of sampling_service. `reset_sampling_factor` will clear the counter.
   3. Modify skywalking/trace/context.py to check if `sampling_service.try_sampling` returns true every time before creating a new SpanContext. If `sampling_service.try_sampling` returns false, `get_context` should return NoopContext.
   4. A scheduler thread will be started when initializing a sampling service, it will reset the sampling factor every 3 seconds.
   
   Dynamically updating the value based on the configuration file or environment variables will not be implemented. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org