gruf icon indicating copy to clipboard operation
gruf copied to clipboard

Idea: Support sample rate for request logger

Open pedelman opened this issue 5 years ago • 1 comments

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.

pedelman avatar Feb 18 '19 18:02 pedelman

cc @mattolson @splittingred

pedelman avatar Feb 18 '19 18:02 pedelman