-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
I need to run this in production because I simply cannot profile locally. If my server has many hits this takes a big toll on my log quota so I'd like to sample when trace information is dumped.
I think the user should be able to provide a sampling rate, like 500, it has 1/500 chance of being recorded.
I think this should be done in the new constructor:
pub fn new(id: &str, processor: Option<fn(&str)>, stats: Option<TracingStats>) -> Trace {
let trace = Trace {
id: id.into(),
processor: processor.unwrap_or(|x: &str| {
println!("{}", x);
}),
stats: stats.unwrap_or(TracingStats::None),
};
Self::register(&trace.id);
trace
}Something like
if rand() == self.sampling_rate {
Self::register(&trace.id);
}Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed