beamlit 0.0.34rc52__py3-none-any.whl → 0.0.34rc54__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.
- beamlit/agents/decorator.py +2 -2
- beamlit/common/instrumentation.py +13 -9
- beamlit/serve/app.py +16 -10
- {beamlit-0.0.34rc52.dist-info → beamlit-0.0.34rc54.dist-info}/METADATA +1 -2
- {beamlit-0.0.34rc52.dist-info → beamlit-0.0.34rc54.dist-info}/RECORD +6 -6
- {beamlit-0.0.34rc52.dist-info → beamlit-0.0.34rc54.dist-info}/WHEEL +0 -0
beamlit/agents/decorator.py
CHANGED
@@ -119,7 +119,7 @@ def get_functions(client, dir="src/functions", from_decorator="function", remote
|
|
119
119
|
|
120
120
|
def agent(
|
121
121
|
agent: Agent | dict = None,
|
122
|
-
|
122
|
+
override_model=None,
|
123
123
|
override_agent=None,
|
124
124
|
mcp_hub=None,
|
125
125
|
remote_functions=None,
|
@@ -132,7 +132,7 @@ def agent(
|
|
132
132
|
)
|
133
133
|
|
134
134
|
client = new_client()
|
135
|
-
chat_model =
|
135
|
+
chat_model = override_model or None
|
136
136
|
settings = init()
|
137
137
|
|
138
138
|
def wrapper(func):
|
@@ -10,7 +10,6 @@ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
|
|
10
10
|
)
|
11
11
|
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
12
12
|
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
|
13
|
-
from opentelemetry.instrumentation.logging import LoggingInstrumentor
|
14
13
|
from opentelemetry.metrics import NoOpMeterProvider
|
15
14
|
from opentelemetry.sdk.metrics import MeterProvider
|
16
15
|
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
|
@@ -112,12 +111,17 @@ def instrument_app(app: FastAPI):
|
|
112
111
|
meter = meter_provider.get_meter(__name__)
|
113
112
|
else:
|
114
113
|
meter = metrics.get_meter(__name__)
|
115
|
-
|
116
114
|
# Only instrument the app when OpenTelemetry is enabled
|
117
|
-
FastAPIInstrumentor.instrument_app(
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
FastAPIInstrumentor.instrument_app(app)
|
116
|
+
HTTPXClientInstrumentor().instrument()
|
117
|
+
|
118
|
+
|
119
|
+
def shutdown_instrumentation():
|
120
|
+
if tracer is not None:
|
121
|
+
trace_provider = trace.get_tracer_provider()
|
122
|
+
if isinstance(trace_provider, TracerProvider):
|
123
|
+
trace_provider.shutdown()
|
124
|
+
if meter is not None:
|
125
|
+
meter_provider = metrics.get_meter_provider()
|
126
|
+
if isinstance(meter_provider, MeterProvider):
|
127
|
+
meter_provider.shutdown()
|
beamlit/serve/app.py
CHANGED
@@ -3,6 +3,7 @@ import importlib
|
|
3
3
|
import os
|
4
4
|
import sys
|
5
5
|
import traceback
|
6
|
+
from contextlib import asynccontextmanager
|
6
7
|
from logging import getLogger
|
7
8
|
from uuid import uuid4
|
8
9
|
|
@@ -13,9 +14,9 @@ from traceloop.sdk import Traceloop
|
|
13
14
|
|
14
15
|
from beamlit.common import HTTPError, get_settings, init
|
15
16
|
from beamlit.common.instrumentation import (
|
16
|
-
get_metrics_exporter,
|
17
17
|
get_resource_attributes,
|
18
18
|
get_span_exporter,
|
19
|
+
shutdown_instrumentation,
|
19
20
|
instrument_app,
|
20
21
|
)
|
21
22
|
|
@@ -41,16 +42,14 @@ logger.info(
|
|
41
42
|
f" on {settings.server.host}:{settings.server.port}"
|
42
43
|
)
|
43
44
|
|
44
|
-
if settings.enable_opentelemetry:
|
45
|
-
Traceloop.init(
|
46
|
-
app_name=settings.name,
|
47
|
-
exporter=get_span_exporter(),
|
48
|
-
metrics_exporter=get_metrics_exporter(),
|
49
|
-
resource_attributes=get_resource_attributes(),
|
50
|
-
should_enrich_metrics=os.getenv("ENRICHED_METRICS", "false") == "true",
|
51
|
-
)
|
52
45
|
|
53
|
-
|
46
|
+
@asynccontextmanager
|
47
|
+
async def lifespan(app: FastAPI):
|
48
|
+
yield
|
49
|
+
shutdown_instrumentation()
|
50
|
+
|
51
|
+
|
52
|
+
app = FastAPI(docs_url=None, redoc_url=None, lifespan=lifespan)
|
54
53
|
app.add_middleware(
|
55
54
|
CorrelationIdMiddleware,
|
56
55
|
header_name="x-beamlit-request-id",
|
@@ -59,6 +58,13 @@ app.add_middleware(
|
|
59
58
|
app.add_middleware(AddProcessTimeHeader)
|
60
59
|
app.add_middleware(AccessLogMiddleware)
|
61
60
|
instrument_app(app)
|
61
|
+
if settings.enable_opentelemetry:
|
62
|
+
Traceloop.init(
|
63
|
+
app_name=settings.name,
|
64
|
+
exporter=get_span_exporter(),
|
65
|
+
resource_attributes=get_resource_attributes(),
|
66
|
+
should_enrich_metrics=os.getenv("ENRICHED_METRICS", "false") == "true",
|
67
|
+
)
|
62
68
|
|
63
69
|
|
64
70
|
@app.get("/health")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: beamlit
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.34rc54
|
4
4
|
Summary: Add your description here
|
5
5
|
Author-email: cploujoux <ch.ploujoux@gmail.com>
|
6
6
|
Requires-Python: >=3.12
|
@@ -17,7 +17,6 @@ Requires-Dist: opentelemetry-api>=1.28.2
|
|
17
17
|
Requires-Dist: opentelemetry-exporter-otlp>=1.28.2
|
18
18
|
Requires-Dist: opentelemetry-instrumentation-fastapi>=0.49b2
|
19
19
|
Requires-Dist: opentelemetry-instrumentation-httpx>=0.49b2
|
20
|
-
Requires-Dist: opentelemetry-instrumentation-logging>=0.49b2
|
21
20
|
Requires-Dist: opentelemetry-sdk>=1.28.2
|
22
21
|
Requires-Dist: pydantic-settings<2.7.0,>=2.6.1
|
23
22
|
Requires-Dist: pydantic<2.11.0,>=2.10.3
|
@@ -7,7 +7,7 @@ beamlit/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
|
|
7
7
|
beamlit/agents/__init__.py,sha256=nf1iwQwGtCG6nDqyVhxfWoqR6dv6X3bvSpCeqkTCFaM,101
|
8
8
|
beamlit/agents/chain.py,sha256=vfCjiFHuu02uTTGicxMlFzjyICQkIjpXrBGs-7uJEsg,2826
|
9
9
|
beamlit/agents/chat.py,sha256=gVyv4FGBdQTDhdutX8l64OUNa6Fdqaw4eCfEDRH0IPQ,3558
|
10
|
-
beamlit/agents/decorator.py,sha256=
|
10
|
+
beamlit/agents/decorator.py,sha256=yY3tObddiFjzLah_eQoecaXORShIrF0qvvF8sYR8r84,10619
|
11
11
|
beamlit/api/__init__.py,sha256=zTSiG_ujSjAqWPyc435YXaX9XTlpMjiJWBbV-f-YtdA,45
|
12
12
|
beamlit/api/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
beamlit/api/agents/create_agent.py,sha256=t5Pr62My2EhQlcIY71MrI73-0_q5Djr3a_Ybt9MIiQQ,3587
|
@@ -130,7 +130,7 @@ beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku
|
|
130
130
|
beamlit/authentication/device_mode.py,sha256=tmr22gllKOZwBRub_QjF5pYa425x-nE8tQNpZ_EGR6g,3644
|
131
131
|
beamlit/common/__init__.py,sha256=saX5X3hRCJ9erSlXuSkZ2VGgquvpgdcofAU_9sM4bCE,354
|
132
132
|
beamlit/common/error.py,sha256=f9oJDFxhoHK-vpjxBgEp0NwWIk0N_THPemUI7uQxVzU,270
|
133
|
-
beamlit/common/instrumentation.py,sha256=
|
133
|
+
beamlit/common/instrumentation.py,sha256=snsH72EA2_RsM3E9qL9KRiuTSNYGkFKVN3NlGblRogw,4331
|
134
134
|
beamlit/common/logger.py,sha256=nN_dSOl4bs13QU3Rod-w3e3jYOnlSrHx3_bs-ACY6Aw,1115
|
135
135
|
beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
|
136
136
|
beamlit/common/settings.py,sha256=b2rvby-ufG3M0AB1ReoWFM-1EzF1LaE-gbokO9HvQDI,3810
|
@@ -252,10 +252,10 @@ beamlit/models/websocket_channel.py,sha256=jg3vN7yS_oOIwGtndtIUr1LsyEA58RXLXahqS
|
|
252
252
|
beamlit/models/workspace.py,sha256=l__bIpbA4oJvxXo7UbEoCcqkvu9MiNt5aXXpZ3bgwHg,4309
|
253
253
|
beamlit/models/workspace_labels.py,sha256=WbnUY6eCTkUNdY7hhhSF-KQCl8fWFfkCf7hzCTiNp4A,1246
|
254
254
|
beamlit/models/workspace_user.py,sha256=70CcifQWYbeWG7TDui4pblTzUe5sVK0AS19vNCzKE8g,3423
|
255
|
-
beamlit/serve/app.py,sha256=
|
255
|
+
beamlit/serve/app.py,sha256=gYQvUK_S7g0Em-idND8HrVDqgg5LlIemheSGlX2Jj8U,3638
|
256
256
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
257
257
|
beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
|
258
258
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
259
|
-
beamlit-0.0.
|
260
|
-
beamlit-0.0.
|
261
|
-
beamlit-0.0.
|
259
|
+
beamlit-0.0.34rc54.dist-info/METADATA,sha256=Dio5lsBaSZ3GI-top1rPGxCQCkykLx7cgLL274ZimBo,2344
|
260
|
+
beamlit-0.0.34rc54.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
261
|
+
beamlit-0.0.34rc54.dist-info/RECORD,,
|
File without changes
|