dbos 1.14.0a4__py3-none-any.whl → 1.14.0a5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dbos/_context.py CHANGED
@@ -215,11 +215,18 @@ class DBOSContext:
215
215
  def end_handler(self, exc_value: Optional[BaseException]) -> None:
216
216
  self._end_span(exc_value)
217
217
 
218
- def get_current_span(self) -> Optional[Span]:
218
+ """ Return the current DBOS span if any. It must be a span created by DBOS."""
219
+
220
+ def get_current_dbos_span(self) -> Optional[Span]:
219
221
  if len(self.context_spans) > 0:
220
222
  return self.context_spans[-1].span
221
223
  return None
222
224
 
225
+ """ Return the current active span if any. It might not be a DBOS span."""
226
+
227
+ def get_current_active_span(self) -> Optional[Span]:
228
+ return dbos_tracer.get_current_span()
229
+
223
230
  def _start_span(self, attributes: TracedAttributes) -> None:
224
231
  if dbos_tracer.disable_otlp:
225
232
  return
@@ -235,7 +242,7 @@ class DBOSContext:
235
242
  attributes["authenticatedUserAssumedRole"] = self.assumed_role
236
243
  span = dbos_tracer.start_span(
237
244
  attributes,
238
- parent=self.context_spans[-1].span if len(self.context_spans) > 0 else None,
245
+ parent=None, # It'll use the current active span as the parent
239
246
  )
240
247
  # Activate the current span
241
248
  cm = use_span(
dbos/_core.py CHANGED
@@ -971,7 +971,7 @@ def decorate_transaction(
971
971
  dbapi_error
972
972
  ) or dbos._app_db._is_serialization_error(dbapi_error):
973
973
  # Retry on serialization failure
974
- span = ctx.get_current_span()
974
+ span = ctx.get_current_dbos_span()
975
975
  if span:
976
976
  span.add_event(
977
977
  "Transaction Failure",
@@ -1090,7 +1090,7 @@ def decorate_step(
1090
1090
  exc_info=error,
1091
1091
  )
1092
1092
  ctx = assert_current_dbos_context()
1093
- span = ctx.get_current_span()
1093
+ span = ctx.get_current_dbos_span()
1094
1094
  if span:
1095
1095
  span.add_event(
1096
1096
  f"Step attempt {attempt} failed",
dbos/_dbos.py CHANGED
@@ -1297,7 +1297,7 @@ class DBOS:
1297
1297
  def span(cls) -> Span:
1298
1298
  """Return the tracing `Span` associated with the current context."""
1299
1299
  ctx = assert_current_dbos_context()
1300
- span = ctx.get_current_span()
1300
+ span = ctx.get_current_active_span()
1301
1301
  assert span
1302
1302
  return span
1303
1303
 
dbos/_logger.py CHANGED
@@ -39,7 +39,7 @@ class DBOSLogTransformer(logging.Filter):
39
39
  if ctx:
40
40
  if ctx.is_within_workflow():
41
41
  record.operationUUID = ctx.workflow_id
42
- span = ctx.get_current_span()
42
+ span = ctx.get_current_active_span()
43
43
  if span:
44
44
  trace_id = format_trace_id(span.get_span_context().trace_id)
45
45
  record.traceId = trace_id
dbos/_tracer.py CHANGED
@@ -77,5 +77,12 @@ class DBOSTracer:
77
77
  def end_span(self, span: Span) -> None:
78
78
  span.end()
79
79
 
80
+ def get_current_span(self) -> Optional[Span]:
81
+ # Return the current active span if any. It might not be a DBOS span.
82
+ span = trace.get_current_span()
83
+ if span.get_span_context().is_valid:
84
+ return span
85
+ return None
86
+
80
87
 
81
88
  dbos_tracer = DBOSTracer()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 1.14.0a4
3
+ Version: 1.14.0a5
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- dbos-1.14.0a4.dist-info/METADATA,sha256=H6-_1NWU-g_Z0T3icZiFc1ZaDVv5_zqFdaf2AUC0vWU,13268
2
- dbos-1.14.0a4.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- dbos-1.14.0a4.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-1.14.0a4.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-1.14.0a5.dist-info/METADATA,sha256=TDRJ02P3spTH9e3UKquTU4V0fhr2Hoq7i_yWosvisGM,13268
2
+ dbos-1.14.0a5.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ dbos-1.14.0a5.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-1.14.0a5.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
@@ -27,10 +27,10 @@ dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
27
27
  dbos/_client.py,sha256=_3Wc2QQc5VDcBuJ3cNb-lWg439OuITo2ex4Y7qb9l44,18800
28
28
  dbos/_conductor/conductor.py,sha256=3E_hL3c9g9yWqKZkvI6KA0-ZzPMPRo06TOzT1esMiek,24114
29
29
  dbos/_conductor/protocol.py,sha256=q3rgLxINFtWFigdOONc-4gX4vn66UmMlJQD6Kj8LnL4,7420
30
- dbos/_context.py,sha256=IMboNgbCqTxfIORqeifE3da-Ce5siMz7MYMLPk5M-AQ,26851
31
- dbos/_core.py,sha256=Lm4gCAVZqNbJdZlXPQ7WROrdhhJ6tWhNzbpe5hgEDSs,49866
30
+ dbos/_context.py,sha256=fzozSsccFVwjtrJVXOfYBA0_x1S21RvvCTyN-VM644g,27111
31
+ dbos/_core.py,sha256=0F1rNYTYLh3kjZB_APh38fblSaKev-2tG8G-9D0rxms,49876
32
32
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
33
- dbos/_dbos.py,sha256=wKLN7W1ej6cyEOHnCtt3-awnU6SR6MQAlOvTTt5_N-E,58219
33
+ dbos/_dbos.py,sha256=ftbVR5wAHSnc_PXpecVC1ZylY6c8UyiZRpcT2kSO8NQ,58226
34
34
  dbos/_dbos_config.py,sha256=_26ktif8qAZW4Ujg6dZfLkYO7dE4CI8b3IQbw_5YkpA,25710
35
35
  dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
36
36
  dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
@@ -40,7 +40,7 @@ dbos/_fastapi.py,sha256=D0H6TPYYTJ0LnkKn7t9sfPwPgDx6fO8AZQtvBcH3ibI,3277
40
40
  dbos/_flask.py,sha256=Npnakt-a3W5OykONFRkDRnumaDhTQmA0NPdUCGRYKXE,1652
41
41
  dbos/_kafka.py,sha256=Gm4fHWl7gYb-i5BMvwNwm5Km3z8zQpseqdMgqgFjlGI,4252
42
42
  dbos/_kafka_message.py,sha256=NYvOXNG3Qn7bghn1pv3fg4Pbs86ILZGcK4IB-MLUNu0,409
43
- dbos/_logger.py,sha256=vvBL4kzJWBPtfcHIuL0nJAq5cgpeo_D3IiIUDicWLOg,4732
43
+ dbos/_logger.py,sha256=iS4AviQViSKiz-IYCjZLWmW9x616IA-Ms9Xtwq1dcx4,4739
44
44
  dbos/_migration.py,sha256=wJrSTYerlkYDFYmkTqo4a7n4WaKmqXh8BdkUEzgSEQQ,10898
45
45
  dbos/_outcome.py,sha256=7HvosMfEHTh1U5P6xok7kFTGLwa2lPaul0YApb3UnN4,8191
46
46
  dbos/_queue.py,sha256=0kJTPwXy3nZ4Epzt-lHky9M9S4L31645drPGFR8fIJY,4854
@@ -65,7 +65,7 @@ dbos/_templates/dbos-db-starter/migrations/env.py.dbos,sha256=IBB_gz9RjC20HPfOTG
65
65
  dbos/_templates/dbos-db-starter/migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
66
66
  dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py,sha256=MpS7LGaJS0CpvsjhfDkp9EJqvMvVCjRPfUp4c0aE2ys,941
67
67
  dbos/_templates/dbos-db-starter/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
68
- dbos/_tracer.py,sha256=8aOAVTBnj2q9DcOb5KJCfo56CVZ1ZvsWBscaNlIX-7k,3150
68
+ dbos/_tracer.py,sha256=1MtRa0bS3ZfpZN3dw-O57_M1lc76WYK2bAThLWW2TSc,3408
69
69
  dbos/_utils.py,sha256=ZdoM1MDbHnlJrh31zfhp3iX62bAxK1kyvMwXnltC_84,1779
70
70
  dbos/_workflow_commands.py,sha256=EmmAaQfRWeOZm_WPTznuU-O3he3jiSzzT9VpYrhxugE,4835
71
71
  dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
@@ -75,4 +75,4 @@ dbos/cli/migration.py,sha256=5GiyagLZkyVvDz3StYxtFdkFoKFCmh6eSXjzsIGhZ_A,3330
75
75
  dbos/dbos-config.schema.json,sha256=LyUT1DOTaAwOP6suxQGS5KemVIqXGPyu_q7Hbo0neA8,6192
76
76
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
77
77
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
78
- dbos-1.14.0a4.dist-info/RECORD,,
78
+ dbos-1.14.0a5.dist-info/RECORD,,