dbos 0.24.0a12__py3-none-any.whl → 0.24.0a14__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.

Potentially problematic release.


This version of dbos might be problematic. Click here for more details.

@@ -1,3 +1,4 @@
1
+ import socket
1
2
  import threading
2
3
  import time
3
4
  import traceback
@@ -51,6 +52,7 @@ class ConductorWebsocket(threading.Thread):
51
52
  request_id=base_message.request_id,
52
53
  executor_id=GlobalParams.executor_id,
53
54
  application_version=GlobalParams.app_version,
55
+ hostname=socket.gethostname(),
54
56
  )
55
57
  websocket.send(info_response.to_json())
56
58
  self.dbos.logger.info("Connected to DBOS conductor")
@@ -59,6 +59,7 @@ class ExecutorInfoRequest(BaseMessage):
59
59
  class ExecutorInfoResponse(BaseMessage):
60
60
  executor_id: str
61
61
  application_version: str
62
+ hostname: Optional[str]
62
63
  error_message: Optional[str] = None
63
64
 
64
65
 
@@ -137,6 +138,7 @@ class WorkflowsOutput:
137
138
  UpdatedAt: Optional[str]
138
139
  QueueName: Optional[str]
139
140
  ApplicationVersion: Optional[str]
141
+ ExecutorID: Optional[str]
140
142
 
141
143
  @classmethod
142
144
  def from_workflow_information(cls, info: WorkflowInformation) -> "WorkflowsOutput":
@@ -164,6 +166,7 @@ class WorkflowsOutput:
164
166
  UpdatedAt=updated_at_str,
165
167
  QueueName=info.queue_name,
166
168
  ApplicationVersion=info.app_version,
169
+ ExecutorID=info.executor_id,
167
170
  )
168
171
 
169
172
 
dbos/_dbos_config.py CHANGED
@@ -34,6 +34,7 @@ class DBOSConfig(TypedDict, total=False):
34
34
  sys_db_pool_size (int): System database pool size
35
35
  log_level (str): Log level
36
36
  otlp_traces_endpoints: List[str]: OTLP traces endpoints
37
+ otlp_logs_endpoints: List[str]: OTLP logs endpoints
37
38
  admin_port (int): Admin port
38
39
  run_admin_server (bool): Whether to run the DBOS admin server
39
40
  """
@@ -45,6 +46,7 @@ class DBOSConfig(TypedDict, total=False):
45
46
  sys_db_pool_size: Optional[int]
46
47
  log_level: Optional[str]
47
48
  otlp_traces_endpoints: Optional[List[str]]
49
+ otlp_logs_endpoints: Optional[List[str]]
48
50
  admin_port: Optional[int]
49
51
  run_admin_server: Optional[bool]
50
52
 
@@ -94,8 +96,8 @@ def parse_database_url_to_dbconfig(database_url: str) -> DatabaseConfig:
94
96
 
95
97
 
96
98
  class OTLPExporterConfig(TypedDict, total=False):
97
- logsEndpoint: Optional[str]
98
- tracesEndpoint: Optional[str]
99
+ logsEndpoint: Optional[List[str]]
100
+ tracesEndpoint: Optional[List[str]]
99
101
 
100
102
 
101
103
  class LoggerConfig(TypedDict, total=False):
@@ -187,17 +189,27 @@ def translate_dbos_config_to_config_file(config: DBOSConfig) -> ConfigFile:
187
189
  ]
188
190
 
189
191
  # Telemetry config
190
- telemetry = {}
192
+ telemetry: TelemetryConfig = {
193
+ "OTLPExporter": {"tracesEndpoint": [], "logsEndpoint": []}
194
+ }
195
+ # For mypy
196
+ assert telemetry["OTLPExporter"] is not None
197
+
191
198
  # Add OTLPExporter if traces endpoints exist
192
199
  otlp_trace_endpoints = config.get("otlp_traces_endpoints")
193
200
  if isinstance(otlp_trace_endpoints, list) and len(otlp_trace_endpoints) > 0:
194
- telemetry["OTLPExporter"] = {"tracesEndpoint": otlp_trace_endpoints[0]}
201
+ telemetry["OTLPExporter"]["tracesEndpoint"] = otlp_trace_endpoints
202
+ # Same for the logs
203
+ otlp_logs_endpoints = config.get("otlp_logs_endpoints")
204
+ if isinstance(otlp_logs_endpoints, list) and len(otlp_logs_endpoints) > 0:
205
+ telemetry["OTLPExporter"]["logsEndpoint"] = otlp_logs_endpoints
206
+
195
207
  # Default to INFO -- the logging seems to default to WARN otherwise.
196
208
  log_level = config.get("log_level", "INFO")
197
209
  if log_level:
198
210
  telemetry["logs"] = {"logLevel": log_level}
199
211
  if telemetry:
200
- translated_config["telemetry"] = cast(TelemetryConfig, telemetry)
212
+ translated_config["telemetry"] = telemetry
201
213
 
202
214
  return translated_config
203
215
 
@@ -287,6 +299,17 @@ def load_config(
287
299
  except ValidationError as e:
288
300
  raise DBOSInitializationError(f"Validation error: {e}")
289
301
 
302
+ # Special case: convert logsEndpoint and tracesEndpoint from strings to lists of strings, if present
303
+ if "telemetry" in data and "OTLPExporter" in data["telemetry"]:
304
+ if "logsEndpoint" in data["telemetry"]["OTLPExporter"]:
305
+ data["telemetry"]["OTLPExporter"]["logsEndpoint"] = [
306
+ data["telemetry"]["OTLPExporter"]["logsEndpoint"]
307
+ ]
308
+ if "tracesEndpoint" in data["telemetry"]["OTLPExporter"]:
309
+ data["telemetry"]["OTLPExporter"]["tracesEndpoint"] = [
310
+ data["telemetry"]["OTLPExporter"]["tracesEndpoint"]
311
+ ]
312
+
290
313
  data = cast(ConfigFile, data)
291
314
  if run_process_config:
292
315
  data = process_config(data=data, use_db_wizard=use_db_wizard, silent=silent)
@@ -494,10 +517,13 @@ def overwrite_config(provided_config: ConfigFile) -> ConfigFile:
494
517
  # Telemetry config
495
518
  if "telemetry" not in provided_config or provided_config["telemetry"] is None:
496
519
  provided_config["telemetry"] = {
497
- "OTLPExporter": {},
520
+ "OTLPExporter": {"tracesEndpoint": [], "logsEndpoint": []},
498
521
  }
499
522
  elif "OTLPExporter" not in provided_config["telemetry"]:
500
- provided_config["telemetry"]["OTLPExporter"] = {}
523
+ provided_config["telemetry"]["OTLPExporter"] = {
524
+ "tracesEndpoint": [],
525
+ "logsEndpoint": [],
526
+ }
501
527
 
502
528
  # This is a super messy from a typing perspective.
503
529
  # Some of ConfigFile keys are optional -- but in practice they'll always be present in hosted environments
@@ -512,14 +538,15 @@ def overwrite_config(provided_config: ConfigFile) -> ConfigFile:
512
538
  telemetry = cast(Dict[str, Any], provided_config["telemetry"])
513
539
  otlp_exporter = cast(Dict[str, Any], telemetry["OTLPExporter"])
514
540
 
541
+ # Merge the logsEndpoint and tracesEndpoint lists from the file with what we have
515
542
  source_otlp = config_from_file["telemetry"]["OTLPExporter"]
516
543
  if source_otlp:
517
544
  tracesEndpoint = source_otlp.get("tracesEndpoint")
518
545
  if tracesEndpoint:
519
- otlp_exporter["tracesEndpoint"] = tracesEndpoint
546
+ otlp_exporter["tracesEndpoint"].extend(tracesEndpoint)
520
547
  logsEndpoint = source_otlp.get("logsEndpoint")
521
548
  if logsEndpoint:
522
- otlp_exporter["logsEndpoint"] = logsEndpoint
549
+ otlp_exporter["logsEndpoint"].extend(logsEndpoint)
523
550
 
524
551
  # Runtime config
525
552
  if "runtimeConfig" in provided_config:
dbos/_logger.py CHANGED
@@ -56,10 +56,10 @@ def config_logger(config: "ConfigFile") -> None:
56
56
  dbos_logger.setLevel(log_level)
57
57
 
58
58
  # Log to the OTLP endpoint if provided
59
- otlp_logs_endpoint = (
59
+ otlp_logs_endpoints = (
60
60
  config.get("telemetry", {}).get("OTLPExporter", {}).get("logsEndpoint") # type: ignore
61
61
  )
62
- if otlp_logs_endpoint:
62
+ if otlp_logs_endpoints:
63
63
  log_provider = PatchedOTLPLoggerProvider(
64
64
  Resource.create(
65
65
  attributes={
@@ -68,12 +68,13 @@ def config_logger(config: "ConfigFile") -> None:
68
68
  )
69
69
  )
70
70
  set_logger_provider(log_provider)
71
- log_provider.add_log_record_processor(
72
- BatchLogRecordProcessor(
73
- OTLPLogExporter(endpoint=otlp_logs_endpoint),
74
- export_timeout_millis=5000,
71
+ for e in otlp_logs_endpoints:
72
+ log_provider.add_log_record_processor(
73
+ BatchLogRecordProcessor(
74
+ OTLPLogExporter(endpoint=e),
75
+ export_timeout_millis=5000,
76
+ )
75
77
  )
76
- )
77
78
  global _otlp_handler
78
79
  _otlp_handler = LoggingHandler(logger_provider=log_provider)
79
80
 
dbos/_tracer.py CHANGED
@@ -27,14 +27,13 @@ class DBOSTracer:
27
27
  if os.environ.get("DBOS__CONSOLE_TRACES", None) is not None:
28
28
  processor = BatchSpanProcessor(ConsoleSpanExporter())
29
29
  provider.add_span_processor(processor)
30
- otlp_traces_endpoint = (
30
+ otlp_traces_endpoints = (
31
31
  config.get("telemetry", {}).get("OTLPExporter", {}).get("tracesEndpoint") # type: ignore
32
32
  )
33
- if otlp_traces_endpoint:
34
- processor = BatchSpanProcessor(
35
- OTLPSpanExporter(endpoint=otlp_traces_endpoint)
36
- )
37
- provider.add_span_processor(processor)
33
+ if otlp_traces_endpoints:
34
+ for e in otlp_traces_endpoints:
35
+ processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=e))
36
+ provider.add_span_processor(processor)
38
37
  trace.set_tracer_provider(provider)
39
38
 
40
39
  def set_provider(self, provider: Optional[TracerProvider]) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.24.0a12
3
+ Version: 0.24.0a14
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-0.24.0a12.dist-info/METADATA,sha256=bbX82S62nJ9ZMnyppiRzrgMB_NuRFhigHkLeTK7aa_I,5522
2
- dbos-0.24.0a12.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.24.0a12.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.24.0a12.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.24.0a14.dist-info/METADATA,sha256=JByekcTcZ0mmvLBZ5rp8VuyTFFKpm2uHco9sc-2MrmU,5522
2
+ dbos-0.24.0a14.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ dbos-0.24.0a14.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.24.0a14.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=uq9LP5uY96kIS9N0yKqlvDwADmtg_Hl30uSUhyuUr-4,754
6
6
  dbos/__main__.py,sha256=P7jAr-7L9XE5mrsQ7i4b-bLr2ap1tCQfhMByLCRWDj0,568
7
7
  dbos/_admin_server.py,sha256=YiVn5lywz2Vg8_juyNHOYl0HVEy48--7b4phwK7r92o,5732
@@ -10,21 +10,21 @@ dbos/_classproperty.py,sha256=f0X-_BySzn3yFDRKB2JpCbLYQ9tLwt1XftfshvY7CBs,626
10
10
  dbos/_cloudutils/authentication.py,sha256=V0fCWQN9stCkhbuuxgPTGpvuQcDqfU3KAxPAh01vKW4,5007
11
11
  dbos/_cloudutils/cloudutils.py,sha256=YC7jGsIopT0KveLsqbRpQk2KlRBk-nIRC_UCgep4f3o,7797
12
12
  dbos/_cloudutils/databases.py,sha256=_shqaqSvhY4n2ScgQ8IP5PDZvzvcx3YBKV8fj-cxhSY,8543
13
- dbos/_conductor/conductor.py,sha256=5mFrE6yEAHWcFjkYr5p2AoPkV6iwYHxsB3K06yaOmqM,15112
14
- dbos/_conductor/protocol.py,sha256=W-BnX-bD5folo96NGrUytuCHW72H-OQwPrkJ9q5Au5c,5534
13
+ dbos/_conductor/conductor.py,sha256=bKf6uGch7Ea3Qdken24AE-kxg_trdmwOngyDiHSInuU,15189
14
+ dbos/_conductor/protocol.py,sha256=MWY3SuIeY6GN2Vg3wQjcxiT0d4zz4ccGzdEkmYYJ6t0,5633
15
15
  dbos/_context.py,sha256=Ue5qu3rzLfRmPkz-UUZi9ZS8iXpapRN0NTM4mbA2QmQ,17738
16
16
  dbos/_core.py,sha256=_a_rSkAWNLoHqzQbkqez0mpctkjDs301123ti3wmKHk,41340
17
17
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
18
18
  dbos/_db_wizard.py,sha256=YEW2qoy6hfHQv2fZ_4nHiPUeHMFofPpNTolJ1Kvw7AQ,8394
19
19
  dbos/_dbos.py,sha256=ymQnOZ8RQehcPVAjjJipoW8StxM7bktTyT_4a_Zlse8,43599
20
- dbos/_dbos_config.py,sha256=-DnOQ5gk3I8RPxNkL3GsAkaYvL8jv5umS8Xv5V7UQkw,20217
20
+ dbos/_dbos_config.py,sha256=rWGy8mB7uLGRgkAybBEz-ogsJQYJpXY41cXNy5eITMs,21513
21
21
  dbos/_debug.py,sha256=mmgvLkqlrljMBBow9wk01PPur9kUf2rI_11dTJXY4gw,1822
22
22
  dbos/_error.py,sha256=B6Y9XLS1f6yrawxB2uAEYFMxFwk9BHhdxPNddKco-Fw,5399
23
23
  dbos/_fastapi.py,sha256=ke03vqsSYDnO6XeOtOVFXj0-f-v1MGsOxa9McaROvNc,3616
24
24
  dbos/_flask.py,sha256=DZKUZR5-xOzPI7tYZ53r2PvvHVoAb8SYwLzMVFsVfjI,2608
25
25
  dbos/_kafka.py,sha256=o6DbwnsYRDtvVTZVsN7BAK8cdP79AfoWX3Q7CGY2Yuo,4199
26
26
  dbos/_kafka_message.py,sha256=NYvOXNG3Qn7bghn1pv3fg4Pbs86ILZGcK4IB-MLUNu0,409
27
- dbos/_logger.py,sha256=utroNAXW71MLYb5D3lsM5xifXT19n5mAidyW-4kwyMA,3499
27
+ dbos/_logger.py,sha256=pSP-CyzHUR6ypousTaeKe2zYMKSqvrbsFru8HJpBHsA,3546
28
28
  dbos/_migrations/env.py,sha256=38SIGVbmn_VV2x2u1aHLcPOoWgZ84eCymf3g_NljmbU,1626
29
29
  dbos/_migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
30
30
  dbos/_migrations/versions/04ca4f231047_workflow_queues_executor_id.py,sha256=ICLPl8CN9tQXMsLDsAj8z1TsL831-Z3F8jSBvrR-wyw,736
@@ -56,7 +56,7 @@ dbos/_templates/dbos-db-starter/migrations/env.py.dbos,sha256=GUV6sjkDzf9Vl6wkGE
56
56
  dbos/_templates/dbos-db-starter/migrations/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
57
57
  dbos/_templates/dbos-db-starter/migrations/versions/2024_07_31_180642_init.py,sha256=MpS7LGaJS0CpvsjhfDkp9EJqvMvVCjRPfUp4c0aE2ys,941
58
58
  dbos/_templates/dbos-db-starter/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
59
- dbos/_tracer.py,sha256=_Id9j9kCrptSNpEpLiRk_g5VPp-DrTWP1WNZInd5BA4,2439
59
+ dbos/_tracer.py,sha256=dFDSFlta-rfA3-ahIRLYwnnoAOmlavdxAGllqwFgnCA,2440
60
60
  dbos/_utils.py,sha256=wjOJzxN66IzL9p4dwcEmQACRQah_V09G6mJI2exQfOM,155
61
61
  dbos/_workflow_commands.py,sha256=CEzR5XghoZscbc2RHb9G-7Eoo4MMuzfeTo-QBZu4VPY,4690
62
62
  dbos/cli/_github_init.py,sha256=Y_bDF9gfO2jB1id4FV5h1oIxEJRWyqVjhb7bNEa5nQ0,3224
@@ -65,4 +65,4 @@ dbos/cli/cli.py,sha256=pet2vf4GLlSDfxfQbsplM9uewD6pJK2ZpLgZlwgBU5w,15627
65
65
  dbos/dbos-config.schema.json,sha256=HtF_njVTGHLdzBGZ4OrGQz3qbPPT0Go-iwd1PgFVTNg,5847
66
66
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
67
67
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
68
- dbos-0.24.0a12.dist-info/RECORD,,
68
+ dbos-0.24.0a14.dist-info/RECORD,,