feat: add support for custom service name in logging (#1194)

This commit is contained in:
cthomas 2025-03-05 09:52:09 -08:00 committed by GitHub
parent 605f1ab415
commit fcfeae12fc
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
services:
letta_server:
environment:
- ENV_NAME=${ENV_NAME} # optional service name
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
otel-collector:

View File

@ -235,12 +235,14 @@ def create_application() -> "FastAPI":
endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
if endpoint:
print(f"▶ Using OTLP tracing with endpoint: {endpoint}")
env_name_suffix = os.getenv("ENV_NAME")
service_name = f"letta-server-{env_name_suffix.lower()}" if env_name_suffix else "letta-server"
from letta.tracing import setup_tracing
setup_tracing(
endpoint=endpoint,
app=app,
service_name="memgpt-server",
service_name=service_name,
)
for route in v1_routes: