Hi all,
I am playing around with the interceptor implementation (
https://github.com/grpc/grpc/issues/8767) and wanted to start exporting
metrics such as per-request latency. To this end, is the servicer context
the right place to keep track of such data? For example:
class MetricInterceptor(UnaryServerInterceptor, StreamServerInterceptor):
def intercept_unary(self, request, servicer_context, server_info,
handler):
response = None
try:
servicer_context.start_time = time.time()
print('I was called')
response = handler(request)
except:
e = sys.exc_info()[0]
print(str(e))
raise
print('Request took {0}
seconds'.format(time.time()-servicer_context.start_time))
return response
...
Thanks for any help.
Best Wishes,
Amit.
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/CANODV3kqDtqZu-QSOoRE%2BDP1%2BwU2Vv1YLt4e9WP4Uc%3DoLp6-KA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.