gruf
gruf copied to clipboard
Idea: Support sample rate for request logger
What? Why?
I would like to define a sample rate for the request logger on a per RPC basis. Currently I have a service which has high volume of traffic and my options are to either disable the logger (using ignore_methods
) for that RPC or to keep logging the request at high volume.
This could potentially be set up like:
c.interceptors.use(
Gruf::Interceptors::Instrumentation::RequestLogging::Interceptor,
formatter: :logstash,
...
sampled_methods: {
'rpc.dummy.high.volume.request' => 0.1
}
)
EDIT:
Another interesting idea would be to attach sample rates to the status of the RPC, as an example say I only want to log 1% of successes and 100% of failed (Grpc::BadStatus
) requests.
cc @mattolson @splittingred