ivcap-lambda 0.8.3__tar.gz → 0.8.4__tar.gz
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.
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/PKG-INFO +1 -1
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/server.py +32 -6
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/pyproject.toml +1 -1
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/AUTHORS.md +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/LICENSE +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/README.md +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/__init__.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/builder.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/decorators.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/executor.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/health_handler.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/logger.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/logging.json +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/mcp.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/py.typed +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/secret.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/service_definition.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/utils.py +0 -0
- {ivcap_lambda-0.8.3 → ivcap_lambda-0.8.4}/ivcap_lambda/version.py +0 -0
|
@@ -17,6 +17,7 @@ from ivcap_service import (
|
|
|
17
17
|
Service,
|
|
18
18
|
SidecarReporter,
|
|
19
19
|
getLogger,
|
|
20
|
+
init_openobserve_from_env,
|
|
20
21
|
otel_instrument,
|
|
21
22
|
print_tool_definition,
|
|
22
23
|
service_log_config,
|
|
@@ -66,7 +67,8 @@ def start_lambda_server(
|
|
|
66
67
|
logger (Logger): optional logger instance; defaults to getLogger("app")
|
|
67
68
|
custom_args (Optional[Callable[[argparse.ArgumentParser], argparse.Namespace]], optional): callback to add extra CLI arguments. Defaults to None.
|
|
68
69
|
run_opts (Optional[Dict[str, Any]], optional): extra options forwarded to uvicorn.Config. Defaults to None.
|
|
69
|
-
with_telemetry: (Optional[bool]):
|
|
70
|
+
with_telemetry: (Optional[bool]): Tri-state control of OpenTelemetry
|
|
71
|
+
instrumentation. CLI flags take precedence over this parameter.
|
|
70
72
|
"""
|
|
71
73
|
if len(tools) == 0:
|
|
72
74
|
raise ValueError(
|
|
@@ -94,8 +96,16 @@ def start_lambda_server(
|
|
|
94
96
|
parser.add_argument(
|
|
95
97
|
"--port", type=int, default=os.environ.get("PORT", "8090"), help="Port number"
|
|
96
98
|
)
|
|
97
|
-
parser.
|
|
98
|
-
|
|
99
|
+
telemetry_group = parser.add_mutually_exclusive_group()
|
|
100
|
+
telemetry_group.add_argument(
|
|
101
|
+
"--with-telemetry",
|
|
102
|
+
action="store_true",
|
|
103
|
+
help="Force-enable OpenTelemetry instrumentation",
|
|
104
|
+
)
|
|
105
|
+
telemetry_group.add_argument(
|
|
106
|
+
"--without-telemetry",
|
|
107
|
+
action="store_true",
|
|
108
|
+
help="Force-disable OpenTelemetry instrumentation",
|
|
99
109
|
)
|
|
100
110
|
parser.add_argument("--with-mcp", action="store_true", help="Add an MCP endpoint")
|
|
101
111
|
parser.add_argument(
|
|
@@ -187,7 +197,21 @@ def start_lambda_server(
|
|
|
187
197
|
f"{title} - {os.getenv('VERSION')} - v{get_version()}|v{get_service_version()}"
|
|
188
198
|
)
|
|
189
199
|
|
|
190
|
-
|
|
200
|
+
try:
|
|
201
|
+
init_openobserve_from_env(
|
|
202
|
+
logger=logger,
|
|
203
|
+
service_name=service.name,
|
|
204
|
+
service_version=service.version,
|
|
205
|
+
)
|
|
206
|
+
except Exception as exc:
|
|
207
|
+
logger.warning("OpenTelemetry initialization failed: %s", exc)
|
|
208
|
+
|
|
209
|
+
effective_with_telemetry = with_telemetry
|
|
210
|
+
if getattr(args, "without_telemetry", False):
|
|
211
|
+
effective_with_telemetry = False
|
|
212
|
+
elif getattr(args, "with_telemetry", False):
|
|
213
|
+
effective_with_telemetry = True
|
|
214
|
+
|
|
191
215
|
set_event_reporter_factory(SidecarReporter) # type: ignore[arg-type]
|
|
192
216
|
|
|
193
217
|
def get_context():
|
|
@@ -206,7 +230,7 @@ def start_lambda_server(
|
|
|
206
230
|
# instrumented the same way as for the HTTP server.
|
|
207
231
|
from .mcp import run_mcp_stdio
|
|
208
232
|
|
|
209
|
-
otel_instrument(
|
|
233
|
+
otel_instrument(effective_with_telemetry, None, logger)
|
|
210
234
|
run_mcp_stdio(service.name, app.version)
|
|
211
235
|
return
|
|
212
236
|
|
|
@@ -224,7 +248,9 @@ def start_lambda_server(
|
|
|
224
248
|
register_mcp(app, "/mcp")
|
|
225
249
|
|
|
226
250
|
otel_instrument(
|
|
227
|
-
|
|
251
|
+
effective_with_telemetry,
|
|
252
|
+
lambda _: FastAPIInstrumentor.instrument_app(app),
|
|
253
|
+
logger,
|
|
228
254
|
)
|
|
229
255
|
|
|
230
256
|
async def _add_version(request: Request, call_next) -> Response:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|