Tracing a slow or failed request
SetOTEL_EXPORTER_OTLP_ENDPOINT to your OpenTelemetry collector’s base URL on
sdk-backend, which serves chat. Set it on dashboard-backend and the worker
too if you want their spans. Unset, telemetry is off.
Useful spans
For a chat question, the request span isPOST /api/v1/query (or, from
0.17.0, POST /api/v1/query/activity with live loader steps). Under it:
To split
llm.invoke between the model and the tools, compare it with the
model_latency_ms of that turn’s tool_loop_round log lines (below). Then see
Models and response time.
Logs
- Format. The backends write one JSON object per line, with
otelTraceIDandotelSpanIDon each line, so you can go from a log line to its trace. The chart’s worker writes JSON too (LOG_FORMAT=jsonis in its defaultenv);LOG_FORMAT=prettygives readable text. - Request fields. From 0.17.0, every backend log line written during a
request carries
request_id, andsession_idandturn_idonce they’re known. - The request id in the browser. From 0.17.0, every backend response has
an
X-Request-IDheader with the samerequest_id. Error responses from the SDK routes, and any unhandled server error (500), also carry areference: the session and turn ids, or the request id when no turn was written. - Model rounds. In a turn that can call tools,
sdk-backendwrites atool_loop_roundline for each model call, withsession_id,round,model_latency_ms, the tokenusage, thetool_callsthe model asked for andtool_result_chars. - Level.
LOG_LEVEL(DEBUG,INFO,WARNINGorERROR; defaultINFO). Keep it atINFOor below if you export logs over OpenTelemetry.
Health checks
Backup, restore and reinstall
What to back up
Back up the database before every upgrade. The 0.17.0 migrations can’t be
reversed.
Restore or reinstall
- Restore the database, both the application and the knowledge-base database if you keep them apart.
- Install the chart version the backup came from, or a later one, with the
same settings. In particular:
- the same
SECRET_ENCRYPTION_KEYSon both backends and the worker; - the same
ON_PREM_ORG_ID, the organization the applications belong to; - the same bucket names in
global.storageBucketsand the worker’sSTORAGE_BUCKET; - the same Pinecone key, and the same identity-provider settings.
- the same
- Let the migrate Job run. It runs
alembic upgrade headon both databases before the new pods start. On a database already at that version it changes nothing. Don’t install a chart older than the database: an older migrate Job stops on a database newer than it knows. - If the Pinecone index was lost, create it again with the same name and settings (the chart README’s Vector Store section has a script), then refresh each source in the Knowledge Base: Refresh for websites, Document360 and Intercom, Refresh URLs for URL lists, and Reprocess Markdown for Markdown.
- Check the install:
GET /health/readyon both backends returns200; you can sign in to the dashboard and see your applications; sources show Ready; and one question in the chat gets an answer from the knowledge base.
The retention CronJob
From 0.17.0, an application’s admin sets how long Moss keeps each kind of data, and turns on Automatic deletion, in Configure > Data & privacy. See Data retention and deletion for the admin side. Automatic deletion is off by default, and saving a period deletes nothing. A CronJob that you set up does the deleting, for the applications that have it on. The same job finishes the per-user deletions that couldn’t run at once, so set it up even if no application turns Automatic deletion on.- Create the database roles. With
roles.enabled: true, the migrate Job createsmoss_lifecycleandmoss_lifecycle_monitor. Otherwise setlifecycle.provisionRole: true, which needsCREATEROLEon the migration credential. Then givemoss_lifecyclea credential, such as a password or RDS IAM. - Create the
moss-lifecycleSecret withLIFECYCLE_DATABASE_URL, connecting asmoss_lifecycle(it never falls back toDATABASE_URL),DATABASE_SCHEMA,S3_ENDPOINT,S3_REGION, and S3 keys or a workload identity. Set bucket names inglobal.storageBuckets, not in this Secret. - Set
lifecycle.enabled: true, upgrade, then restartdashboard-backend(kubectl rollout restart deploy/<release>-dashboard-backend) so Data & privacy shows the job as running.
- A failed Job is a real failure. Runs that find the job busy, behind or on hold exit 0. The last log line is a JSON summary.
- Buckets must match. Both backends and the CronJob must use the same
RECORDINGS_BUCKET,STORAGE_BUCKETandDOM_SNAPSHOTS_BUCKET, or deletion sweeps the wrong bucket. Set them once inglobal.storageBuckets;helm templatefails when they disagree. - Network. The Job needs Postgres, object storage and DNS.
- Audit events and deletion records have their own periods, set on
dashboard-backend, which prunes them daily itself, without the CronJob:AUDIT_RETENTION_DAYS(default365). An application’s settings can’t change it, and an application on legal hold keeps all its events.DELETION_PROOF_RETENTION_DAYS: how long completed per-user deletion requests are kept. Unset keeps them.AUDIT_MINIMUM_DAYS(from 0.17.0; unset is 0): when a user’s data is deleted, the application’s content-free admin audit events about that user that are younger than this are kept.dashboard-backendrefuses to start if it’s larger thanAUDIT_RETENTION_DAYSor a setDELETION_PROOF_RETENTION_DAYS.- The prune needs a database role with
DELETEon the audit events. With a single database role for everything, it has one. Ifdashboard-backendruns under a least-privilege role, setMAINTENANCE_DATABASE_URLto connect as themoss_maintenancerole, as the chart README’sMAINTENANCE_DATABASE_URLrow describes. Otherwise the prune fails and the audit log keeps growing.
- Not covered: telemetry you export, database backups, and copies outside Moss. Data deleted in Moss stays in a backup until that backup expires.
python -m scripts.retention_operator in dashboard-backend, connected with
the database owner’s credential; ask Moss for the operator guide.
Running a cloud safety filter alongside Moss
Moss doesn’t configure safety filters. You turn on Model Armor, or Gemini’s safety settings, in your own Google Cloud project, and Moss’s requests pass through them like any other. When the filter blocks a request or its reply, from 0.16.24 Moss:- answers “A safety filter blocked this request, so I can’t answer it. If it keeps happening on this page, please contact your administrator.”;
- doesn’t retry, since asking again would be blocked again;
- records the turn as blocked rather than failed, and shows a blocked step in the session;
- logs the stage (request or reply) and the provider’s reason, such as
MODEL_ARMORorSAFETY, never the blocked content.
Common questions
How do we trace a slow request? SetOTEL_EXPORTER_OTLP_ENDPOINT on sdk-backend and compare the spans under
POST /api/v1/query. From 0.17.0, the X-Request-ID response header gives
the request_id to search the logs for.
What do we need to back up?
The database and SECRET_ENCRYPTION_KEYS, plus object storage if you want to
keep screenshots and recordings. Pinecone vectors can be rebuilt, and Redis
holds nothing durable.
We restored the database. Do we need to reset anything?
No. Install the same chart version, or a later one, with the same settings and
Secrets; the migrate Job changes nothing on a database that’s already current.
Data & privacy says retention isn’t running. Why?
The retention CronJob isn’t set up, or dashboard-backend wasn’t restarted
after you set lifecycle.enabled: true. See
The retention CronJob.
Is it safe to put Model Armor in blocking mode?
Moss answers a blocked request with a clear message, doesn’t retry it, and
records the turn as blocked, so users aren’t left without an answer.