Observability

Spotlight exports no trace and no metric by default, and it opens no telemetry connection. It writes its logs as JSON lines to stdout. Nothing leaves the install unless the operator sets an exporter. Spotlight never sends telemetry to usespotlight.ai.

Traces and metrics use OpenTelemetry and its standard OTEL_* variables, so any OTLP backend can receive them: Grafana, SigNoz, Jaeger, Honeycomb, Datadog and others. Errors go to Sentry; see Error reporting.

Spotlight

Set these on Spotlight, with the other self-hosted settings.

VariableDefaultDescription
OTEL_EXPORTER_OTLP_ENDPOINTnoneThe OTLP endpoint for traces and metrics. Setting it turns on both.
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTnoneThe OTLP endpoint for traces only. Setting it turns on traces.
OTEL_EXPORTER_OTLP_METRICS_ENDPOINTnoneThe OTLP endpoint for metrics only. Setting it turns on metrics.
OTEL_EXPORTER_OTLP_PROTOCOLhttp/protobufhttp/protobuf, http/json or grpc.
OTEL_EXPORTER_OTLP_HEADERSnoneHeaders on each export, such as an API key: key1=value1,key2=value2.
OTEL_TRACES_EXPORTERotlp with a traces endpoint, else noneotlp, console, zipkin or none.
OTEL_METRICS_EXPORTERotlp with a metrics endpoint, else noneotlp, prometheus, console or none.
OTEL_EXPORTER_PROMETHEUS_PORT9464The port of the scrape endpoint GET /metrics, with OTEL_METRICS_EXPORTER=prometheus.
OTEL_EXPORTER_PROMETHEUS_HOSTall interfacesThe address the scrape endpoint listens on.
OTEL_SERVICE_NAMEspotlight-control-planeThe service name on each trace and metric.
OTEL_TRACES_SAMPLERparentbased_always_onA standard sampler name, such as parentbased_traceidratio.
OTEL_TRACES_SAMPLER_ARGnoneThe argument of the sampler, such as 0.1.
OTEL_SDK_DISABLEDfalsetrue exports nothing, whatever else is set.
LOG_LEVELdebug in development, else infofatal, error, warn, info, debug, trace or silent.

OTEL_LOGS_EXPORTER has no effect. Spotlight never sends its logs over OTLP.

The scrape endpoint has no authentication. Do not expose port 9464 outside the network that scrapes it.

Hosts

Set these on the host, with the other host settings.

VariableDefaultDescription
LOG_LEVELinfoerror, warn, info or debug. fatal reads as error, trace as debug, and silent writes nothing. The host gives it to each sandbox and egress as SPOTLIGHT_LOG_LEVEL.
OTEL_TRACES_SAMPLERparentbased_always_onWhether the host samples the trace of a claim: always_off, traceidratio and their parentbased_ forms. Set the same sampler as on Spotlight, because Spotlight follows the host's decision.
OTEL_TRACES_SAMPLER_ARG1The ratio for traceidratio.
SPOTLIGHT_HEALTH_ADDRnoneWhere the host answers GET /healthz and GET /readyz, such as 127.0.0.1:9100. See Health checks. Without it, the host listens on nothing.

The host, the runner and egress write JSON lines to stdout. To collect them, see Collect the logs of a host. They export no traces or metrics.

Each claim of the host starts a W3C trace, sampled as the variables above say. The host sends the trace on the claim as traceparent and gives it to the sandbox as SPOTLIGHT_TRACEPARENT. The runner sends it on each of its calls to Spotlight. So the claim and every call of the run have one trace id, in the logs of the host, the runner and Spotlight. The data plane exports no span of its own, so a backend shows each call's parent span as missing. The agent and the code it runs do not get SPOTLIGHT_TRACEPARENT.

Health checks

EndpointAnswers
GET /api/health200 with {"status":"ok"} while the process serves requests.
GET /api/health/ready200 with {"status":"ready","checks":[…]} when every check passes. 503 with {"status":"not_ready","checks":[…]} when one fails.

The readiness checks:

CheckPasses when
postgresSELECT 1 answers, on a connection of its own.
s3Spotlight can write an empty object pending/readiness to S3_BUCKET.

Each check fails when it takes longer than 1.5 seconds. Spotlight reuses an answer for 5 seconds. The answer names each check with ok or failed. The reason for a failure is in the log line Readiness check failed, not in the answer. Neither endpoint needs a session, and neither writes an access log line.

A host and a shared egress answer health checks on SPOTLIGHT_HEALTH_ADDR when it is set:

EndpointAnswers
GET /healthz200 while the process runs.
GET /readyz200 when ready, else 503 with the reason. A host is ready when a heartbeat reached Spotlight in the last 90 seconds and the container runtime answers. A shared egress is ready when it reaches Spotlight's /api/health within 2 seconds.

Logs

Each request writes one request completed line with req.method, route, path, res.statusCode and responseTime. route is the matched route, such as /api/teams/:teamId/replay-checks/:checkId. path is the path without its query. The line keeps only these headers: accept, content-length, content-type, traceparent and user-agent of the request, and content-length, content-type, etag and x-request-id of the response. Its level is error for a status of 500 or more, warn for 400 or more, else info. A refused request has a refusal field: the problem type when there is one, and the error that refused it. For a refusal by an application rule, kind replaces type, such as not-found or conflict.

Every line of a request has reqId, which is also the x-request-id response header. It is the trace id of the request: from the span Spotlight starts for it, else from its traceparent header, else a new UUID. The calls of one run share a trace, so they share a reqId. With traces on, every line written inside a span also has trace_id and span_id.

Every line written during a pending job, an event delivery or a webhook delivery has the ids of that work, when known: workspaceId, teamId, taskId, runId, eventId and deliveryId.

MessageLevelWritten when
Recorded eventinfoSpotlight records a domain or integration event, after the transaction commits. Has kind, eventId, the ids of the event and causedBy for an event a hook or delivery caused.
Ignored a deliveryinfoA webhook delivery leads to nothing. reason is no-provider, nothing-new or no-workspace.
Did not act on a happeninginfoA happening changes no task. reason is station-has-no-line, no-rule-matched, opens-nothing, no-review-policy-takes-it, no-task-matched or no-line-opens-it.
Did not dispatch a runinfoA task needs a run that Spotlight cannot start. reason is station-has-no-harness, harness-not-prepared or station-has-no-order.
Did not dispatch a chat runinfoA chat needs a run that Spotlight cannot start. reason is harness-has-no-command or no-placement.
Did not provision a runnerinfoNo push pool of the workspace can take a run or a check now. reason is no-pool-matches or no-pool-has-room. At most once in 10 minutes for each run or check, on each control plane. Not written for a workspace without a push pool, or for a run that needs secrets when no pool has egress.
Claimed a run, Claimed a checkinfoA runner takes a run or a check.
A hook did not matchdebugA hook listens to a happening but its condition is false.
Skipped a hook firinginfoA firing ends without a step. reason is hook-deleted or no-longer-matches.
Skipped a pollwarnThe team of a poll no longer exists. reason is team-not-found. At most once in 10 minutes for each team and integration.
An expression failed, so it read as false or emptywarnAn expression in a configuration fails when it is read. Has location and error, the code of the error, such as no_such_key. At most once in 10 minutes for each expression and code.
Could not discover the OAuth server of an integrationwarnDiscovery fails. Has the server's host and the name of the error. At most once in 10 minutes for each host.
Could not read the access token of a linked accountwarnThe token of a person's linked account cannot be read. Has the name of the error. At most once in 10 minutes for each person and provider.
Ignored a GitHub eventinfoThe GitHub App installation of the event belongs to no workspace.
Refused a webhook deliverywarnA webhook is refused with 401. reason is unknown-team, unknown-integration or bad-signature.
Refused to start a runnerwarnA host asks to start a runner and Spotlight refuses. reason is host-unreported, host-outdated or image-unreported.
Outbound calldebugSpotlight gets an answer from a call it makes with fetch. outbound has host, method, status and durationMs.
Outbound call refusedwarnSuch a call gets a 429 or a status of 500 or more.
Outbound call failedwarnSuch a call gets no answer.
Limiting outbound calls on this instance alone, without RediswarnRedis fails or does not answer within 2 seconds while Spotlight counts a workspace's requests toward its rate limit. Each server then counts on its own. At most once a minute on each server.
Reading a deliverywarnReading a webhook delivery fails and Spotlight tries again.
Gave up reading a deliveryerrorReading a webhook delivery fails for the last time.
Delivering a domain eventerrorA subscriber fails on an event and Spotlight tries again.
Dead-lettering a domain event deliveryerrorA subscriber fails on an event for the 8th time.
A journal entry from a runner does not read as JSONwarnA runner sends a journal entry whose data Spotlight cannot read. Has runId, attempt, seq and type, never the data. At most once in 10 minutes for each run and type.
Readiness check failedwarnA readiness check fails. Has check and err.

The database keeps every recorded event with its causal chain in event_outbox. The logs do not copy that history.

What telemetry never contains

No log line, span or metric contains:

  • An event payload, a prompt, a tool input or a secret value.
  • A header other than those listed in Logs, such as Cookie, Authorization, Set-Cookie, Referer, Location or a webhook's token header.
  • A request body or a response body.
  • A query string.
  • A token in the path of a request. path names it by its parameter, such as /api/invites/:token, and spans have the route in place of the path.
  • The path or query of a call that Spotlight makes. Logs and spans name the host only.

Metric attributes never contain the id of a workspace, team, task, run or chat. Ids are in logs and spans only.

Traces

SpanNameHas
A request to SpotlightThe method and the route, such as GET /api/teams/:teamId/replay-checks/:checkIdThe standard HTTP attributes, with the route as url.path, and the client's address.
A Postgres querypg.query:, the SQL command and the database nameThe statement with its placeholders, never the values. Only inside another span.
A call that Spotlight makesThe methodThe host, and the origin as url.full.
A pending jobThe source, such as Judging runsspotlight.workspace_id, spotlight.run_id and the other ids of the job.
An event deliveryThe subscriberspotlight.event_id, spotlight.event_kind and the ids of the event. A link to the span that recorded the event.
A webhook deliveryReading a deliveryspotlight.delivery_id, spotlight.integration and the ids of the delivery.

With traces on, each run records the traceparent of the request or work that queued it, and the span of its claim links to that trace. Each event records the traceparent of the request or work that raised it. The delivery of the event starts its own trace and links to that one.

Metrics

Spotlight's own metrics:

MetricTypeAttributesDescription
spotlight.readinessgaugespotlight.check1 when the check passes, 0 when it fails.
spotlight.eventscounterspotlight.event.kindEvents recorded.
spotlight.outbox.duegaugeEvent deliveries that are due.
spotlight.outbox.oldest_due_age_secondsgaugeAge of the oldest event delivery that is due.
spotlight.outbox.dead_letteredgaugeEvent deliveries that Spotlight stopped trying.
spotlight.outbox.deliveriescounterspotlight.subscriber, spotlight.delivery.outcomeAttempts to deliver an event: delivered, retried or dead_lettered.
spotlight.jobscounterspotlight.job.source, spotlight.job.outcomePending jobs worked: processed, stale, retried or dead_lettered.
spotlight.hook_firingscounterspotlight.hook_firing.outcomefired when Spotlight queues a firing. skipped or loop_stopped when it works one, so a firing can count twice.
spotlight.journal.unreadcounterspotlight.journal.typeJournal entries from runners that do not read as JSON.
spotlight.runs.claim_wait_secondshistogramspotlight.run.kindHow long a run waited between queued and claimed, once for each claim. A requeued run counts from its requeue. task, chat, replay, search or other.
spotlight.runsgaugespotlight.run.stateRuns that are queued, claimed or suspended.
spotlight.runs.oldest_queued_age_secondsgaugeAge of the oldest run that a runner can claim now.
spotlight.runner_hosts.onlinegaugeHosts with a heartbeat in the last 90 seconds.
spotlight.lookup_callscounterspotlight.integration, spotlight.tool, spotlight.lookup_call.priced, spotlight.lookup_call.lateLookup calls that reported model usage. priced is yes or no. late is yes for a call that timed out and answered later, else no.
spotlight.lookup_call.tokenshistogramspotlight.integration, spotlight.tool, spotlight.lookup_call.priced, spotlight.lookup_call.late, spotlight.lookup_call.directionThe tokens of a lookup call, input or output.
spotlight.lookup_call.costhistogramspotlight.integration, spotlight.tool, spotlight.lookup_call.priced, spotlight.lookup_call.late, spotlight.lookup_call.currencyThe cost of a priced lookup call.
spotlight.lookup_call.timed_outcounterspotlight.integration, spotlight.toolLookup calls that did not answer within 30 seconds. A call that answers later with model usage is then counted in the three metrics above with late set to yes.
spotlight.unmetered_callscounterspotlight.integration, spotlight.tool, spotlight.unmetered_call.caller, spotlight.unmetered_call.reason, spotlight.unmetered_call.pricedTool calls that reported model usage that no run counts. caller is hook or agent. reason is no-run for an event outside a run, or after-usage for a call after the run's usage was recorded. priced is yes or no.
spotlight.unmetered_call.tokenshistogramspotlight.integration, spotlight.tool, spotlight.unmetered_call.caller, spotlight.unmetered_call.reason, spotlight.unmetered_call.priced, spotlight.unmetered_call.directionThe tokens of such a call, input or output.
spotlight.unmetered_call.costhistogramspotlight.integration, spotlight.tool, spotlight.unmetered_call.caller, spotlight.unmetered_call.reason, spotlight.unmetered_call.priced, spotlight.unmetered_call.currencyThe cost of such a call when it is priced.

Spotlight reads the gauges from the database each time it exports metrics.

The standard metrics: http.server.request.duration with http.route, http.client.request.duration, db.client.connection.count, db.client.connection.pending_requests and db.client.connection.max, and the Node.js runtime metrics nodejs.eventloop.*, v8js.memory.* and v8js.gc.duration.

In Prometheus, each . becomes _ and counters end in _total, such as spotlight_jobs_total. A backend that adds unit suffixes names the standard HTTP metric http_server_request_duration_seconds.

Examples

To an OpenTelemetry Collector or Grafana Alloy in the same network:

OTEL_EXPORTER_OTLP_ENDPOINT=http://alloy:4318

To a hosted OTLP backend, with its API key as a header:

OTEL_EXPORTER_OTLP_ENDPOINT=https://api.honeycomb.io
OTEL_EXPORTER_OTLP_HEADERS=x-honeycomb-team=<api key>
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1

Metrics for Prometheus to scrape, and no traces:

OTEL_METRICS_EXPORTER=prometheus

Agent traces

The traces of agents in runs are product data. Spotlight collects them itself and shows them on the run. The OTEL_* variables above do not change that collection, and Spotlight does not give them to sandboxes.

On this page