chore: read otel endpoint from settings (#1312)

This commit is contained in:
cthomas 2025-03-17 10:28:32 -07:00 committed by GitHub
parent 05762613a6
commit 8ea895c5aa
5 changed files with 10 additions and 5 deletions

View File

@ -64,8 +64,7 @@ ENV LETTA_ENVIRONMENT=${LETTA_ENVIRONMENT} \
POSTGRES_USER=letta \ POSTGRES_USER=letta \
POSTGRES_PASSWORD=letta \ POSTGRES_PASSWORD=letta \
POSTGRES_DB=letta \ POSTGRES_DB=letta \
COMPOSIO_DISABLE_VERSION_CHECK=true \ COMPOSIO_DISABLE_VERSION_CHECK=true
LETTA_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
WORKDIR /app WORKDIR /app

View File

@ -256,7 +256,7 @@ def create_application() -> "FastAPI":
) )
# Set up OpenTelemetry tracing # Set up OpenTelemetry tracing
otlp_endpoint = os.getenv("LETTA_OTEL_EXPORTER_OTLP_ENDPOINT") otlp_endpoint = settings.otel_exporter_otlp_endpoint
if otlp_endpoint: if otlp_endpoint:
print(f"▶ Using OTLP tracing with endpoint: {otlp_endpoint}") print(f"▶ Using OTLP tracing with endpoint: {otlp_endpoint}")
env_name_suffix = os.getenv("ENV_NAME") env_name_suffix = os.getenv("ENV_NAME")

View File

@ -90,8 +90,8 @@ async def trace_error_handler(_request: Request, exc: Exception) -> JSONResponse
# Add error details to current span # Add error details to current span
span = trace.get_current_span() span = trace.get_current_span()
if span: if span:
span.add_event( span.record_exception(
name="exception", exc,
attributes={ attributes={
"exception.message": error_msg, "exception.message": error_msg,
"exception.type": type(exc).__name__, "exception.type": type(exc).__name__,

View File

@ -62,6 +62,9 @@ exporters:
max_elapsed_time: 300s max_elapsed_time: 300s
service: service:
telemetry:
logs:
level: error
pipelines: pipelines:
traces: traces:
receivers: [otlp] receivers: [otlp]

View File

@ -20,6 +20,9 @@ exporters:
max_backups: 5 max_backups: 5
service: service:
telemetry:
logs:
level: error
pipelines: pipelines:
traces: traces:
receivers: [otlp] receivers: [otlp]