Logs, request ids, traces and metrics
What an instance writes to its log, and how to follow one request through everything it started. Logs are for the
operator: SHADE keeps no dashboard for them, so read them with docker logs, Coolify's log view or the log collector
you already use (decision 0018 point 11). Traces are built and off until you point them at a collector (Traces); a Prometheus metrics endpoint is built and off until you set a port and a token (Metrics); errors can also go to a GlitchTip or Sentry you run (Error reporting).
The format
Every container writes one JSON object per line: to standard output for debug and info, to standard error for
warn and error. A line has:
| Field | Meaning |
|---|---|
time | When, in UTC (ISO 8601). |
level | debug, info, warn or error. debug lines are not written. |
msg | What happened, in a sentence. |
role | The container role: admin, public, worker or all (SHADE_API_ROLE). |
version | SHADE's version. |
requestId | The request id of what was running (below). Not on lines from start-up. |
traceId, spanId | The trace and span that were active, when traces are on. |
plugin | The module whose code was running, when it was one: its own log lines, the events it hears, its jobs, its sandbox's output. |
Anything else on a line is a detail of that event: error (name, message and stack of what failed), queue,
attempt, and so on.
Each request writes one line when it ends, "msg":"request", with method, route, status and durationMs:
{"time":"2026-11-11T09:12:44.103Z","level":"info","msg":"request","role":"admin","version":"0.1.0","requestId":"4b1e9c52-0d57-4c1f-8f61-2a0a6d3d7a10","method":"POST","route":"/api/collections/:slug/:id/publish","status":200,"durationMs":41}
route is the route's pattern, never the address that was asked for, so ids in the path and the query string are not in
the log. A request that no route answered (the admin's own files, a 404) has the route unmatched.
For development, SHADE_LOG_FORMAT=text writes readable lines instead
(time LEVEL [role] [plugin] (request id) message key=value). The default is json; production keeps it.
One request id through everything
Every request has an id. It is sent back in the X-Request-Id header, is on every log line written while the request
is handled, and is kept with what the request starts:
- A queued job (a form delivery to a module, an outgoing webhook, a module's job) is stored with the id of the request that queued it, and runs, logs and fails under it, even in another container and minutes later. A job nobody asked for from a request gets an id of its own.
- The error log keeps the id of the request, or of the job, that failed. An error on the Errors screen has the id to search the log for.
- Outgoing webhooks carry it in an
X-Request-Idheader, so the receiver can log it too. - Hooks and thread tasks run under the id of the request that caused them.
- A schedule run and a process get an id of their own, so their lines and the jobs they queue can be followed.
To follow a request, take its id from the response header, the Errors screen or a log line, and search the logs of every container for it.
An id sent in with the request is not used by default: a visitor could otherwise choose the id their request is
logged under. If the proxy in front of SHADE is yours and sets X-Request-Id itself (so one id runs from the proxy to
SHADE), set SHADE_TRUST_PROXY_IDS=true. SHADE then keeps an incoming id of up to 64 letters, digits, - and _;
anything else is replaced by a new one.
Traces over OpenTelemetry
Traces show where the time of one request went: the request, the database transactions it ran, the jobs it queued, the
events it wrote and the calls it made out. They are off until you set OTEL_EXPORTER_OTLP_ENDPOINT. Without it SHADE
loads no tracing code, sends nothing and costs nothing. With it, every container sends over OTLP/HTTP to
<endpoint>/v1/traces and <endpoint>/v1/logs, to a collector or backend you run (Grafana Tempo, Jaeger, SigNoz,
GlitchTip or an OpenTelemetry Collector in front of any of them).
What gets a span:
| Span | Named and tagged with |
|---|---|
| A request | POST /api/collections/:slug/:id/publish: the route's pattern and the status. Never the address asked for. |
| A database transaction | db.transaction |
| A queued job, and a job giving up | job <queue>: the queue and the try. It starts a trace of its own and links to the span that queued it, so you can open the request from the job (a job can run minutes later, in another container). |
| A schedule run | schedule <name> |
| A process start, restart and stop | process start: the module and the process |
| A hook | hook <name>: the module whose hook runs |
| A thread task | thread task <name>: the module and the task |
A call out (kernel/outbound.ts) | outbound: the host, never the path or the query |
What a module does through ctx | ctx.fetch (host), `ctx.db select |
| What a module traces itself | ctx.trace, with plugin set |
A log line written while a span is active carries its traceId and spanId, and is also sent over OTLP as a log record
with the same ids, so a log line and its trace join in your backend. Lines go to standard output as before.
A traceparent header on an incoming request is not used by default: a visitor could otherwise join someone else's
trace. If the proxy in front of SHADE is yours and starts the trace (SHADE_TRUST_PROXY_IDS=true), SHADE continues a
valid traceparent (version 00, lower-case hex, no all-zero id); anything else starts a new trace.
Spans of what runs inside a module's process thread or a thread task's own thread are not sent yet: the task's span in the API is, with its time and result.
Metrics for Prometheus
SHADE can serve its numbers in the Prometheus text format (version 0.0.4). It is off until you set
SHADE_METRICS_PORT. The endpoint is a second, tiny server on that port of its own, and it answers only
GET /metrics: any other path is a 404, and a request without the right token is a 401. Every container role serves
the numbers about itself.
- Make a token of at least 32 characters (
openssl rand -hex 32) and setSHADE_METRICS_TOKENto it. SHADE refuses to start with a port and no token (or a token that is too short). - Set
SHADE_METRICS_PORT, for example9464, on every container you want to scrape. It must not bePORT. - Never publish the port or give it a domain. The deploy template does not publish it. Prometheus reaches it on the
instance's own network (
http://admin:9464/metrics), so run Prometheus on that network, or reach it through a private network such as a VPN. The token is a second lock, not a reason to put the port on the internet.
A Prometheus scrape config for the three containers of a small instance:
scrape_configs:
- job_name: shade
scrape_interval: 30s
authorization:
type: Bearer
credentials_file: /etc/prometheus/shade-token
static_configs:
- targets: ['admin:9464', 'public:9464', 'worker:9464']
Every series carries the label role (admin, public, worker or all). Labels come from fixed sets only: a value
outside them is counted as other. A label is never an id, a path with an id, a query string, an address or anything a
visitor typed (route patterns such as /api/collections/:slug/:id/publish, queue and schedule names, module names from the
installed list, statuses).
| Metric | Labels | Meaning |
|---|---|---|
shade_http_requests_total | method, route, status | Requests. route is the pattern; a request no route answered is unmatched. |
shade_http_request_duration_seconds | method, route, status_class | Histogram (_bucket, _sum, _count) of how long requests took; status_class is 2xx, 4xx… |
shade_database_up | none | 1 when the database answers a query. (postgres.js exposes no pool counts, so there are none.) |
shade_redis_up | none | 1 when Redis answers. |
shade_queue_jobs_total | queue, outcome | Jobs this container ran, by how a try ended: done, retried, postponed (an outside service's breaker was open; the try did not count), gave_up or released (the worker stopped before it was done and gave it back; the try did not count). Worker only. |
shade_queue_jobs | queue, state | Jobs in Redis per queue: ready, delayed or claimed. |
shade_queue_waiting_jobs | queue | Jobs that are due and not finished, from the outbox. |
shade_queue_oldest_job_age_seconds | queue | How long the oldest due, unfinished job has waited (0 when none): a queue falling behind. |
shade_schedule_runs_total | schedule, outcome | Schedule runs on this worker: ok, waited (an outside service's breaker was open) or failed. A due time another worker took is no run. |
shade_processes | state | Processes of modules on this worker: starting, running, backoff, failed, stopped. |
shade_thread_tasks_total | plugin, task, outcome | Thread tasks: done, failed or timeout. |
shade_thread_task_duration_seconds | plugin, task | Histogram of how long thread tasks took. |
shade_module_healthy | module | 1 when SHADE measures the installed module healthy, as the Modules page does. |
shade_breaker_state | owner, host | Each outside service's circuit breaker as this container last saw it: 0 closed, 1 half-open (trying), 2 open (decision 0018 point 13). owner is the core feature that calls (email, media, backups, webhooks, content-delivery, errors) or package:<name>; host the first 50 hosts, then other. |
shade_breaker_opens_total | owner, host | Breakers this container saw open after repeated failures. |
shade_breaker_refused_total | owner, host | Calls out this container did not make because their breaker was open. |
shade_module_state | module, state | 1 for the state a module is in (on, off, or paused after repeated failures), 0 for the others. |
shade_error_groups_opened_last_hour | none | Error groups first seen in the last hour. |
shade_limit_used | limit | What the instance uses of each usage limit: bytes for storage and database, otherwise a count (api-requests: this month). |
shade_limit_max | limit | The limit's maximum, in the same unit; left out for a limit that is not set. |
shade_process_memory_bytes | kind | rss, heap_used, heap_total, external. |
shade_event_loop_delay_seconds | stat | How late the event loop ran since the last scrape: mean, p99, max. |
shade_collector_up | collector | 1 when a number measured at the scrape (database, queues, modules…) answered in time (2 seconds, 5 for modules), 0 when it failed; its numbers are then left out, never stale. |
The numbers of the whole instance (the queue depths and ages, module health, error groups, usage limits) come from the worker (and
all) containers only, because every container would report the same, and adding them up would count them twice.
Counters start over when a container restarts, as Prometheus expects (rate() handles it).
No body, header, cookie, address, person's id or token is in the output. Prometheus, dashboards and alerting are yours: SHADE keeps none of them.
Error reporting
Every error SHADE stores in its error log can also be sent, as it happens,
to a GlitchTip or Sentry that you run or that is in the EU. It is off until you set SHADE_ERROR_REPORTING_DSN to the
project's DSN (https://<key>@<host>/<project>, from the project's settings). SHADE refuses to start with a DSN it cannot
read. There is no Sentry package in SHADE: it posts a Sentry envelope to <host>/api/<project>/envelope/ with fetch
and a 5 second timeout.
What is sent for each error is the error group's scrubbed fields and nothing else: the error's name, message and stack, its
source (api, hook, job, sandbox, site or package:<name>), the module, the request id, SHADE's version as the
release, the container role, and the environment if you set SHADE_ERROR_REPORTING_ENVIRONMENT. The texts have the
same scrubbing as the error log (email and IP addresses, query strings, credentials and tokens are taken out). No request
or answer body, header, cookie, address, user or team member is sent.
- Server errors only, by default. Errors that browsers wrote (a site's, and a module's admin screen part that failed in
an editor's browser) are sent only with
SHADE_ERROR_REPORTING_SITE=true. Their text comes from a browser, so treat it as someone else's text. - The error log stays the record. Sending copies; it never waits. A send that fails or is slow is written to the log
once a minute at most (
warn) and dropped, and is not recorded in the error log again. A burst of more than ten sends at once drops the rest. - A forwarding module goes first. If you install the error forwarding module and it is on, SHADE gives it each error
first, and the module sends it where its own rules say (for example, different projects per source; Error forwarding). A rule that says not to forward an error makes the module decline it, so SHADE sends it to the DSN. When the module
says it sent it, SHADE sends nothing itself. When the module is off, did not load, declines the error, fails or takes
longer than 5 seconds, SHADE sends it to
SHADE_ERROR_REPORTING_DSN. So an error goes once, and never nowhere, as long as the DSN is set: without a DSN, an error the module declines or fails on is sent nowhere. Set the DSN even when you use the module if you want that guarantee. Only one module can forward errors, and only a trusted one. - Privacy. The host you name receives error messages, so it must be yours or in the EU, and the client must know of it (privacy). Modules cannot change these settings: they are read from the environment only.
What is never logged or traced
No request or answer body, header, cookie, IP address, email address, user's or team member's id or name, query string
or token. Texts in a line are passed through the same scrubbing as the error log
(email addresses, IP addresses, query strings, credentials in addresses, API tokens and payment providers' keys are
replaced), and a detail named like a body, headers, a cookie, a token, a password, an email address or an IP address is
written as [redacted]. Modules' own lines follow the same rules.
Spans follow them too: a span's name and attributes are fixed words, route patterns, hosts and numbers, never a body,
header, cookie, query string, address, a person's id or a token. What a module gives ctx.trace is scrubbed the same way.
Whether a collector keeps a span's start and end times is a matter for its retention.
Logs and traces you ship elsewhere are still yours to protect: send it only to a host you chose, in the EU or the client's own (privacy), and tell the client it exists.
Settings
| Variable | Default | Meaning |
|---|---|---|
SHADE_LOG_FORMAT | json | json or text (for development). |
SHADE_TRUST_PROXY_IDS | false | true: keep a valid incoming X-Request-Id and continue a valid traceparent from the proxy in front. |
OTEL_EXPORTER_OTLP_ENDPOINT | empty (off) | The collector's address, such as http://otel-collector:4318. Set: traces and logs go there over OTLP/HTTP. |
OTEL_EXPORTER_OTLP_HEADERS | empty | Headers sent with every export, name=value pairs separated by commas (a collector's token; percent-encode special characters). |
OTEL_SERVICE_NAME | shade | The service name on every span and log record; one name per client keeps instances apart. |
SHADE_METRICS_PORT | empty (off) | The port of the metrics endpoint, on its own. Never publish it. |
SHADE_METRICS_TOKEN | empty | The bearer token for GET /metrics, at least 32 characters; required with the port. |
SHADE_ERROR_REPORTING_DSN | empty (off) | The DSN of a GlitchTip or Sentry project, https://<key>@<host>/<project> (Error reporting). A bad one stops start-up. |
SHADE_ERROR_REPORTING_SITE | false | true: also send errors that browsers wrote (sites, modules' admin parts). |
SHADE_ERROR_REPORTING_ENVIRONMENT | empty | The environment on each report (production, staging). |