dbos 2.3.0a4__py3-none-any.whl → 2.4.0a1__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.
- dbos/_logger.py +23 -16
- dbos/_migration.py +17 -2
- dbos/_tracer.py +24 -19
- {dbos-2.3.0a4.dist-info → dbos-2.4.0a1.dist-info}/METADATA +1 -1
- {dbos-2.3.0a4.dist-info → dbos-2.4.0a1.dist-info}/RECORD +8 -8
- {dbos-2.3.0a4.dist-info → dbos-2.4.0a1.dist-info}/WHEEL +0 -0
- {dbos-2.3.0a4.dist-info → dbos-2.4.0a1.dist-info}/entry_points.txt +0 -0
- {dbos-2.3.0a4.dist-info → dbos-2.4.0a1.dist-info}/licenses/LICENSE +0 -0
dbos/_logger.py
CHANGED
|
@@ -68,30 +68,37 @@ def config_logger(config: "ConfigFile") -> None:
|
|
|
68
68
|
)
|
|
69
69
|
disable_otlp = config.get("telemetry", {}).get("disable_otlp", False) # type: ignore
|
|
70
70
|
|
|
71
|
-
if not disable_otlp
|
|
71
|
+
if not disable_otlp:
|
|
72
72
|
|
|
73
|
-
from opentelemetry._logs import set_logger_provider
|
|
73
|
+
from opentelemetry._logs import get_logger_provider, set_logger_provider
|
|
74
74
|
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
|
|
75
75
|
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
|
|
76
76
|
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
|
|
77
77
|
from opentelemetry.sdk.resources import Resource
|
|
78
78
|
from opentelemetry.semconv.attributes.service_attributes import SERVICE_NAME
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
# Only set up OTLP provider and exporter if endpoints are provided
|
|
81
|
+
log_provider = get_logger_provider()
|
|
82
|
+
if otlp_logs_endpoints is not None:
|
|
83
|
+
if not isinstance(log_provider, LoggerProvider):
|
|
84
|
+
log_provider = LoggerProvider(
|
|
85
|
+
Resource.create(
|
|
86
|
+
attributes={
|
|
87
|
+
SERVICE_NAME: config["name"],
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
set_logger_provider(log_provider)
|
|
92
|
+
|
|
93
|
+
for e in otlp_logs_endpoints:
|
|
94
|
+
log_provider.add_log_record_processor(
|
|
95
|
+
BatchLogRecordProcessor(
|
|
96
|
+
OTLPLogExporter(endpoint=e),
|
|
97
|
+
export_timeout_millis=5000,
|
|
98
|
+
)
|
|
93
99
|
)
|
|
94
|
-
|
|
100
|
+
|
|
101
|
+
# Even if no endpoints are provided, we still need a LoggerProvider to create the LoggingHandler
|
|
95
102
|
global _otlp_handler
|
|
96
103
|
_otlp_handler = LoggingHandler(logger_provider=log_provider)
|
|
97
104
|
|
dbos/_migration.py
CHANGED
|
@@ -209,8 +209,18 @@ ALTER TABLE \"{schema}\".workflow_status ADD COLUMN queue_partition_key TEXT;
|
|
|
209
209
|
"""
|
|
210
210
|
|
|
211
211
|
|
|
212
|
+
def get_dbos_migration_three(schema: str) -> str:
|
|
213
|
+
return f"""
|
|
214
|
+
create index "idx_workflow_status_queue_status_started" on \"{schema}\"."workflow_status" ("queue_name", "status", "started_at_epoch_ms")
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
|
|
212
218
|
def get_dbos_migrations(schema: str) -> list[str]:
|
|
213
|
-
return [
|
|
219
|
+
return [
|
|
220
|
+
get_dbos_migration_one(schema),
|
|
221
|
+
get_dbos_migration_two(schema),
|
|
222
|
+
get_dbos_migration_three(schema),
|
|
223
|
+
]
|
|
214
224
|
|
|
215
225
|
|
|
216
226
|
def get_sqlite_timestamp_expr() -> str:
|
|
@@ -303,4 +313,9 @@ sqlite_migration_two = """
|
|
|
303
313
|
ALTER TABLE workflow_status ADD COLUMN queue_partition_key TEXT;
|
|
304
314
|
"""
|
|
305
315
|
|
|
306
|
-
|
|
316
|
+
sqlite_migration_three = """
|
|
317
|
+
CREATE INDEX "idx_workflow_status_queue_status_started"
|
|
318
|
+
ON "workflow_status" ("queue_name", "status", "started_at_epoch_ms")
|
|
319
|
+
"""
|
|
320
|
+
|
|
321
|
+
sqlite_migrations = [sqlite_migration_one, sqlite_migration_two, sqlite_migration_three]
|
dbos/_tracer.py
CHANGED
|
@@ -25,6 +25,10 @@ class DBOSTracer:
|
|
|
25
25
|
def config(self, config: ConfigFile) -> None:
|
|
26
26
|
self.otlp_attributes = config.get("telemetry", {}).get("otlp_attributes", {}) # type: ignore
|
|
27
27
|
self.disable_otlp = config.get("telemetry", {}).get("disable_otlp", False) # type: ignore
|
|
28
|
+
otlp_traces_endpoints = (
|
|
29
|
+
config.get("telemetry", {}).get("OTLPExporter", {}).get("tracesEndpoint") # type: ignore
|
|
30
|
+
)
|
|
31
|
+
|
|
28
32
|
if not self.disable_otlp:
|
|
29
33
|
from opentelemetry import trace
|
|
30
34
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
|
|
@@ -38,25 +42,26 @@ class DBOSTracer:
|
|
|
38
42
|
)
|
|
39
43
|
from opentelemetry.semconv.attributes.service_attributes import SERVICE_NAME
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
tracer_provider = trace.get_tracer_provider()
|
|
46
|
+
|
|
47
|
+
# Only set up OTLP provider and exporter if endpoints are provided
|
|
48
|
+
if otlp_traces_endpoints is not None:
|
|
49
|
+
if not isinstance(tracer_provider, TracerProvider):
|
|
50
|
+
resource = Resource(
|
|
51
|
+
attributes={
|
|
52
|
+
SERVICE_NAME: config["name"],
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
tracer_provider = TracerProvider(resource=resource)
|
|
57
|
+
if os.environ.get("DBOS__CONSOLE_TRACES", None) is not None:
|
|
58
|
+
processor = BatchSpanProcessor(ConsoleSpanExporter())
|
|
59
|
+
tracer_provider.add_span_processor(processor)
|
|
60
|
+
trace.set_tracer_provider(tracer_provider)
|
|
61
|
+
|
|
62
|
+
for e in otlp_traces_endpoints:
|
|
63
|
+
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=e))
|
|
64
|
+
tracer_provider.add_span_processor(processor)
|
|
60
65
|
|
|
61
66
|
def set_provider(self, provider: "Optional[TracerProvider]") -> None:
|
|
62
67
|
self.provider = provider
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
dbos-2.
|
|
2
|
-
dbos-2.
|
|
3
|
-
dbos-2.
|
|
4
|
-
dbos-2.
|
|
1
|
+
dbos-2.4.0a1.dist-info/METADATA,sha256=wAuuiW_zghWbm2aYpSvKd_HR4ERFfu-HbRvOt0eTlhc,14532
|
|
2
|
+
dbos-2.4.0a1.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
dbos-2.4.0a1.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
|
4
|
+
dbos-2.4.0a1.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
|
|
5
5
|
dbos/__init__.py,sha256=M7FdFSBGhcvaLIXrNw_0eR68ijwMWV7_UEyimHMP_F4,1039
|
|
6
6
|
dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
|
|
7
7
|
dbos/_admin_server.py,sha256=hubQJw5T8zGKCPNS6FQTXy8jQ8GTJxoYQaDTMlICl9k,16267
|
|
@@ -24,8 +24,8 @@ dbos/_fastapi.py,sha256=toYYfbe2aui2aHw0021PoXi2dKlI6NzO3M3pHB0dHOk,3421
|
|
|
24
24
|
dbos/_flask.py,sha256=Npnakt-a3W5OykONFRkDRnumaDhTQmA0NPdUCGRYKXE,1652
|
|
25
25
|
dbos/_kafka.py,sha256=cA3hXyT-FR4LQZnaBMVLTZn7oko76rcTUC_kOo6aSis,4352
|
|
26
26
|
dbos/_kafka_message.py,sha256=NYvOXNG3Qn7bghn1pv3fg4Pbs86ILZGcK4IB-MLUNu0,409
|
|
27
|
-
dbos/_logger.py,sha256=
|
|
28
|
-
dbos/_migration.py,sha256=
|
|
27
|
+
dbos/_logger.py,sha256=ByGkkGwEWaqE9z6E2VNDFOgu_z4LNe7_SxsVgAXzoT0,5081
|
|
28
|
+
dbos/_migration.py,sha256=wxkdsWoT0nMixEP99MALPdPz2-Sucxy1mVPXZTuqRU0,10770
|
|
29
29
|
dbos/_outcome.py,sha256=7HvosMfEHTh1U5P6xok7kFTGLwa2lPaul0YApb3UnN4,8191
|
|
30
30
|
dbos/_queue.py,sha256=GmqZHl9smES1KSmpauhSdsnZFJHDyfvRArmC-jBibhw,6228
|
|
31
31
|
dbos/_recovery.py,sha256=K-wlFhdf4yGRm6cUzyhcTjQUS0xp2T5rdNMLiiBErYg,2882
|
|
@@ -46,7 +46,7 @@ dbos/_templates/dbos-db-starter/__package/schema.py,sha256=7Z27JGC8yy7Z44cbVXIRE
|
|
|
46
46
|
dbos/_templates/dbos-db-starter/dbos-config.yaml.dbos,sha256=0wPktElM7kMB3OPHTXw4xBk9bgGKMqOHrrr7x_R23Z8,446
|
|
47
47
|
dbos/_templates/dbos-db-starter/migrations/create_table.py.dbos,sha256=pVm2Q0AsxS8pg85llbrXFD6jMccMqGjhGRjTEvS-hXk,942
|
|
48
48
|
dbos/_templates/dbos-db-starter/start_postgres_docker.py,sha256=lQVLlYO5YkhGPEgPqwGc7Y8uDKse9HsWv5fynJEFJHM,1681
|
|
49
|
-
dbos/_tracer.py,sha256=
|
|
49
|
+
dbos/_tracer.py,sha256=jTlTkb5vUr_Ai5W9JIJf6FpYjAL0IWL52EWM_HXsi54,3958
|
|
50
50
|
dbos/_utils.py,sha256=ZdoM1MDbHnlJrh31zfhp3iX62bAxK1kyvMwXnltC_84,1779
|
|
51
51
|
dbos/_workflow_commands.py,sha256=k-i1bCfNrux43BHLT8wQ-l-MVZX3D6LGZLH7-uuiDRo,4951
|
|
52
52
|
dbos/cli/_github_init.py,sha256=R_94Fnn40CAmPy-zM00lwHi0ndyfv57TmIooADjmag4,3378
|
|
@@ -56,4 +56,4 @@ dbos/cli/migration.py,sha256=I0_0ngWTuCPQf6Symbpd0lizaxWUKe3uTYEmuCmsrdU,3775
|
|
|
56
56
|
dbos/dbos-config.schema.json,sha256=47wofTZ5jlFynec7bG0L369tAXbRQQ2euBxBXvg4m9c,1730
|
|
57
57
|
dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
|
|
58
58
|
version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
|
|
59
|
-
dbos-2.
|
|
59
|
+
dbos-2.4.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|