diff --git a/compose.tracing.yaml b/compose.tracing.yaml index 80d6a3c1..169ab517 100644 --- a/compose.tracing.yaml +++ b/compose.tracing.yaml @@ -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: diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py index d6a4ff60..246711bc 100644 --- a/letta/server/rest_api/app.py +++ b/letta/server/rest_api/app.py @@ -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: