Answer the question
In order to leave comments, you need to log in
How to implement grpc service performance monitoring in python using sentry?
I guess I need to write custom transactions.
1. What does span mean? I don't understand at all.
transaction = sentry_sdk.Hub.current.scope.transaction
span = sentry_sdk.Hub.current.scope.span
2. do_task() - instead of this function, should I call the code for processing my requests coming to the grpc server? That is, now any request will go through the creation of a sentry transaction?
So?
import sentry_sdk
class TestService(
stt_pb2_grpc.TestService
):
def Method(
self, request,
context
):
transaction = sentry_sdk.Hub.current.scope.transaction
if transaction is None:
with sentry_sdk.start_transaction(name="task_method"):
response = do_task(request) # МОЯ ОБРАБОТКА ЗАПРОСА
else:
transaction.name = "new name"
with transaction.start_child(op="task_method"): # equivalent to `sentry_sdk.start_span`
response = do_task(request)
return response
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question