grpc-rs icon indicating copy to clipboard operation
grpc-rs copied to clipboard

[WIP] add server instrumentation for calls

Open fbandersnatch opened this issue 6 years ago • 2 comments

I want to enable user-pluggable functionality to run on every request. The goal is to use it for logging and monitoring e.g., I'll use it for request counts, request rates and processing time counters. This commit has a simple no-op example to achieve this.

Usage:

// Replace the use of `create_greeter` with `create_instrumented_greeter`
let service = helloworld_grpc::create_instrumented_greeter(GreeterService, MyServerInstrumenter);

Implement trait ServerInstrumenter with the needed instrumentation, as MyServiceInstrumenter.

WIP: This is still work in progress, I'm open to feedback on this

Are there plans to implement such use cases in other ways?

fbandersnatch avatar Mar 06 '19 08:03 fbandersnatch

Nice job! We planed to do this long time ago but still not get the time to make it really happen. Really excited to see someone can pick it up finally!

The underlying architecture of grpcio is very similar to the C# implementation. So you can refer to the similar proposal and its implementation at grpc/proposal#38.

BusyJay avatar Mar 12 '19 03:03 BusyJay

Cool, I'll look at their implementation. For now, I'm not sure why compilation is failing, I'll submit an update just to kick a build.

fbandersnatch avatar Mar 12 '19 09:03 fbandersnatch