dbos 2.3.0a3__py3-none-any.whl → 2.3.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.
Potentially problematic release.
This version of dbos might be problematic. Click here for more details.
- dbos/_logger.py +23 -16
- dbos/_tracer.py +24 -19
- dbos/cli/cli.py +1 -15
- {dbos-2.3.0a3.dist-info → dbos-2.3.0a5.dist-info}/METADATA +1 -1
- {dbos-2.3.0a3.dist-info → dbos-2.3.0a5.dist-info}/RECORD +8 -8
- {dbos-2.3.0a3.dist-info → dbos-2.3.0a5.dist-info}/WHEEL +0 -0
- {dbos-2.3.0a3.dist-info → dbos-2.3.0a5.dist-info}/entry_points.txt +0 -0
- {dbos-2.3.0a3.dist-info → dbos-2.3.0a5.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/_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
|
dbos/cli/cli.py
CHANGED
|
@@ -140,26 +140,12 @@ def start() -> None:
|
|
|
140
140
|
Forward kill signals to children.
|
|
141
141
|
|
|
142
142
|
When we receive a signal, send it to the entire process group of the child.
|
|
143
|
-
If that doesn't work, SIGKILL them then exit.
|
|
144
143
|
"""
|
|
145
144
|
# Send the signal to the child's entire process group
|
|
146
145
|
if process.poll() is None:
|
|
147
146
|
os.killpg(os.getpgid(process.pid), signum)
|
|
148
147
|
|
|
149
|
-
#
|
|
150
|
-
for _ in range(10): # Wait up to 1 second
|
|
151
|
-
if process.poll() is not None:
|
|
152
|
-
break
|
|
153
|
-
time.sleep(0.1)
|
|
154
|
-
|
|
155
|
-
# If the child is still running, force kill it
|
|
156
|
-
if process.poll() is None:
|
|
157
|
-
try:
|
|
158
|
-
os.killpg(os.getpgid(process.pid), signal.SIGKILL)
|
|
159
|
-
except Exception:
|
|
160
|
-
pass
|
|
161
|
-
|
|
162
|
-
# Exit immediately
|
|
148
|
+
# Exit
|
|
163
149
|
os._exit(process.returncode if process.returncode is not None else 1)
|
|
164
150
|
|
|
165
151
|
# Configure the single handler only on Unix-like systems.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
dbos-2.3.
|
|
2
|
-
dbos-2.3.
|
|
3
|
-
dbos-2.3.
|
|
4
|
-
dbos-2.3.
|
|
1
|
+
dbos-2.3.0a5.dist-info/METADATA,sha256=6AYt02EU_HQcgWtPsrfSfSA1huBFMwV76S5U7OoaQ4A,14532
|
|
2
|
+
dbos-2.3.0a5.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
3
|
+
dbos-2.3.0a5.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
|
|
4
|
+
dbos-2.3.0a5.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,7 +24,7 @@ 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=
|
|
27
|
+
dbos/_logger.py,sha256=ByGkkGwEWaqE9z6E2VNDFOgu_z4LNe7_SxsVgAXzoT0,5081
|
|
28
28
|
dbos/_migration.py,sha256=Fvc3m4dC4oDpjPMHX-tUZVnXklVB9OMMojSLuVyV9ak,10312
|
|
29
29
|
dbos/_outcome.py,sha256=7HvosMfEHTh1U5P6xok7kFTGLwa2lPaul0YApb3UnN4,8191
|
|
30
30
|
dbos/_queue.py,sha256=GmqZHl9smES1KSmpauhSdsnZFJHDyfvRArmC-jBibhw,6228
|
|
@@ -46,14 +46,14 @@ 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
|
|
53
53
|
dbos/cli/_template_init.py,sha256=AltKk256VocgvxLpuTxpjJyACrdHFjbGoqYhHzeLae4,2649
|
|
54
|
-
dbos/cli/cli.py,sha256=
|
|
54
|
+
dbos/cli/cli.py,sha256=hPZJmrQZWn8mcXou7DHaHl8luSEQTEWaYlnIsLw8WY4,27150
|
|
55
55
|
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.3.
|
|
59
|
+
dbos-2.3.0a5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|