Просмотр исходного кода

fix: Fix merediths transaction (#20049)

* fix: Fix merediths transaction

* add trace_id
Markus Unterwaditzer 4 лет назад
Родитель
Сommit
b131bbc8e3
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      src/sentry/shared_integrations/client.py

+ 11 - 0
src/sentry/shared_integrations/client.py

@@ -208,9 +208,20 @@ class BaseApiClient(object):
             tags={self.integration_type: self.name},
         )
 
+        try:
+            with sentry_sdk.configure_scope() as scope:
+                parent_span_id = scope.span.span_id
+                trace_id = scope.span.trace_id
+        except AttributeError:
+            parent_span_id = None
+            trace_id = None
+
         with sentry_sdk.start_transaction(
             op=u"{}.http".format(self.integration_type),
             name=u"{}.http_response.{}".format(self.integration_type, self.name),
+            parent_span_id=parent_span_id,
+            trace_id=trace_id,
+            sampled=True,
         ) as span:
             try:
                 resp = getattr(session, method.lower())(